-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (88 loc) · 3.04 KB
/
pull_request.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Pull request checks
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main
jobs:
style_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: NodeJS install
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: pnpm install
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true
- name: Lint code
run: |
pnpm run tsc --noEmit
pnpm run eslint .
- name: Lint commits
if: github.event_name == 'pull_request'
run: |
pnpm run commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
notify_success:
runs-on: ubuntu-latest
needs: style_check
permissions:
pull-requests: write
if: success()
steps:
- name: Comment success
uses: actions/github-script@v7
with:
script: |
const body = `### ✅ Successful Review
Great news! Your pull request has been successfully reviewed, and no errors were found.
### ⏳ Next Steps
The author will review the changes shortly, and we look forward to merging your contributions into the project. Thank you for your hard work and dedication! 🎉`
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["ci-success"]
});
notify_failure:
runs-on: ubuntu-latest
needs: style_check
permissions:
pull-requests: write
if: failure()
steps:
- name: Comment failure
uses: actions/github-script@v7
with:
script: |
const body = `### ⚠️ Review Required
Thank you for your contribution! Upon review, we've identified some issues in the pull request that need to be addressed. Please take a moment to review the errors and make the necessary adjustments before we can proceed with the integration.
### 🛠️ Next Steps
Feel free to reach out if you have any questions or need assistance. We appreciate your effort in improving our codebase! 🙏`
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["ci-failure"]
});