Skip to content

Commit

Permalink
Merge pull request #7 from pvcy/jc/comment-on-migration-failure
Browse files Browse the repository at this point in the history
Comment on success or failure in the PR
  • Loading branch information
john-craft authored Oct 24, 2023
2 parents 6fe42ae + d0f479f commit a5571ee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,24 @@ jobs:
- name: Run Sequelize migrations
run: |
cd ./users-api/src
npx sequelize-cli db:migrate
if npx sequelize-cli db:migrate; then
echo "PR_COMMENT=:white_check_mark: Database migration succeeded!" >> $GITHUB_ENV
else
echo "PR_COMMENT=:x: Database migration failed." >> $GITHUB_ENV
fi
continue-on-error: true

- name: Cleanup
run: docker stop $DB_HOST

- name: Post a comment to PR
- name: Comment on success of migration
run: |
PR_COMMENT="This PR contains database migrations."
PR_COMMENT=":x: Database migration failed"
# Post the comment to the PR
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "{\"body\":\"$PR_COMMENT\"}"
-d "{\"body\":\"env.PR_COMMENT\"}"

0 comments on commit a5571ee

Please sign in to comment.