diff --git a/.github/workflows/check-migrations.yml b/.github/workflows/check-migrations.yml index 1572613..e995ff0 100644 --- a/.github/workflows/check-migrations.yml +++ b/.github/workflows/check-migrations.yml @@ -6,6 +6,10 @@ on: paths: - 'src/database/migrations/**' +permissions: + issues: write + pull-requests: write + jobs: check-migrations: runs-on: ubuntu-latest @@ -19,7 +23,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const { data: comments } = await github.rest.issues.listComments({ + const { data: comments } = await github.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, @@ -30,10 +34,13 @@ jobs: ); if (!commentExists) { - await github.rest.issues.createComment({ + await github.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: "It looks like you've made changes to the migrations. Have you run `npm run db:generate-schema` to ensure the updated schemas are included in your PR?" }); + console.log("Comment added"); + } else { + console.log("Comment already exists"); }