Replace hand-made json validator by validateJSON utility #2593
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: Changelog Updater | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
update-changelog: | |
runs-on: macos-latest | |
steps: | |
- name: Check trigger | |
id: check | |
uses: khan/pull-request-comment-trigger@v1.1.0 | |
with: | |
trigger: '\changelog-update' | |
reaction: rocket | |
prefix_only: 'true' | |
env: | |
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}' | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Debug | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
COMMENT_BODY: ${{github.event.comment.body}} | |
COMMENT_USER: ${{github.event.comment.user.login}} | |
ISSUE_USER: ${{github.event.issue.user.login}} | |
PR_NUM: ${{github.event.issue.number}} | |
ISSUE_AUTHOR_ASSOCIATION: ${{github.event.issue.author_association}} | |
COMMENT_AUTHOR_ASSOCIATION: ${{github.event.comment.author_association}} | |
run: | | |
echo "COMMENT_BODY: $COMMENT_BODY" | |
echo "COMMENT_USER: $COMMENT_USER" | |
echo "ISSUE_USER: $ISSUE_USER" | |
echo "PR_NUM: $PR_NUM" | |
echo "ISSUE_AUTHOR_ASSOCIATION: $ISSUE_AUTHOR_ASSOCIATION" | |
echo "COMMENT_AUTHOR_ASSOCIATION: $COMMENT_AUTHOR_ASSOCIATION" | |
- name: Clone git repo | |
if: steps.check.outputs.triggered == 'true' | |
uses: actions/checkout@v4 | |
- name: Configure Git Agent | |
if: steps.check.outputs.triggered == 'true' | |
run: | | |
git config --global user.name 'Changelog Bot' | |
git config --global user.email 'changelog-bot@users.noreply.github.com' | |
- name: Update Changelog | |
if: (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && steps.check.outputs.triggered == 'true' | |
env: | |
COMMENT_BODY: ${{github.event.comment.body}} | |
PR_NUM: ${{github.event.issue.number}} | |
USER: ${{github.event.issue.user.login}} | |
run: | | |
echo "Found it" | |
echo "Body: $COMMENT_BODY" | |
echo "Pull Request Number: $PR_NUM" | |
echo $COMMENT_BODY > comment_body.file | |
echo "Pull Request Number: $PR_NUM" >> comment_body.file | |
echo "User: $USER" >> comment_body.file | |
python3 scripts/update-changelog.py -changelog-file changelog.md -changes-file comment_body.file | |
- name: Commit changelog | |
if: steps.check.outputs.triggered == 'true' | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
git add changelog.md | |
git commit -nm "Updated changelog.md" | |
git push origin HEAD |