forked from Spuckwaffel/dumpspace
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 2.53 KB
/
pull_request_message.yml
File metadata and controls
86 lines (73 loc) · 2.53 KB
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
name: Game Check
on:
pull_request_target:
types:
- opened
jobs:
greet:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Greet Pull Request
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const bannedUsers = JSON.parse(fs.readFileSync('./ban_list.json', 'utf8'));
const username = context.actor;
if (bannedUsers.includes(username)) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${username}, you are not allowed to submit pull requests to this repository. Closing PR.`
});
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
state: "closed"
});
core.setFailed(`User ${username} is blocked from making pull requests.`);
return;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thanks for the pull request! I will look into the request and merge it upon success.'
})
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install PyGithub
run: |
python -m pip install pygithub
- name: Check files
run: |
python scripts/check_files.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: script_result
- name: Set PR return message
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ env.ACTION_MESSAGE }}'
})
- name: Accept pull request on success
if: ${{ env.ACTION_STATUS == 'success' }}
uses: pascalgn/automerge-action@v0.15.6
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""