-
-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (40 loc) · 1.52 KB
/
check-migrations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Check Migrations
on:
pull_request:
types: [opened, synchronize]
# paths:
# - 'src/database/migrations/**'
permissions:
issues: write
pull-requests: write
jobs:
check-migrations:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check and add comment to PR
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log("----CONTEXT---", JSON.stringify(context, null, 2));
console.log("GitHub Object:", Object.keys(github));
console.log("Context Issue:", context.issue);
console.log("Context Payload:", context.payload);
const { data: comments } = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const commentExists = comments.some(comment =>
comment.body.includes("It looks like you've made changes to the migrations.")
);
if (!commentExists) {
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?"
});
}