feat: Add from jsrepo
#14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: changy | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
changy: | |
runs-on: ubuntu-latest | |
if: ${{ github.actor != 'github-actions[bot]' }} | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9.12.3 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get Latest Changes 🆕 | |
run: | | |
output=$(npx changy@latest latest --today) | |
if [ -z "$output" ]; then | |
echo "CHANGELOG_EMPTY=true" >> $GITHUB_ENV | |
else | |
echo "CHANGELOG_EMPTY=false" >> $GITHUB_ENV | |
echo "CHANGELOG<<EOF" >> $GITHUB_ENV | |
echo "$output" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
fi | |
- name: Get current date | |
run: echo "CURRENT_DATETIME=$(TZ=UTC date +'%Y-%m-%d %I:%M %p')" >> $GITHUB_ENV | |
- name: Comment no CHANGELOG found | |
if: env.CHANGELOG_EMPTY == 'true' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
:warning: No changelogs found | |
**If your PR includes user facing changes make sure to add them with `npx changy add`.** | |
### How to add a changelog | |
```bash | |
npx changy add | |
``` | |
_(UTC) ${{ env.CURRENT_DATETIME }}_ | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-repeats: false | |
- name: Comment CHANGELOG | |
if: env.CHANGELOG_EMPTY == 'false' | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
# Found changelogs | |
```md | |
${{ env.CHANGELOG }} | |
``` | |
> [!NOTE] | |
> If you didn't add these changes it could be from a previous commit today. | |
_(UTC) ${{ env.CURRENT_DATETIME }}_ | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-repeats: false |