-
-
Notifications
You must be signed in to change notification settings - Fork 7k
38 lines (36 loc) · 1.18 KB
/
invalid.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
name: Check on Invalid PR
on:
pull_request_target:
branches:
- main
paths-ignore:
- '.github/**'
- 'data.json'
- 'CONTRIBUTING.md'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This PR is not valid. Please read [contributing guidelines](https://github.com/MunGell/awesome-for-beginners/blob/main/CONTRIBUTING.md).'
});
if (context.payload.pull_request.labels.indexOf('Invalid') === -1) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Invalid']
});
}
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
state: 'closed'
});