-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (42 loc) · 1.46 KB
/
issue.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
# Workflow file for registering dad jokes from issues
name: Register oyajigyagu from issues
on:
issues:
types: [opened]
permissions:
issues: write
contents: write
jobs:
register-dad-jokes:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.issue.title, 'Add oyajigyagu ') }}
steps:
- name: Check permissions
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
const { data: permissions } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.payload.issue.user.login
});
if (permissions.permission !== 'write' && permissions.permission !== 'admin') {
throw new Error('User does not have write permissions');
}
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Install dependencies
run: npm install
working-directory: .github/scripts
- name: Acquire lock
run: |
node .github/scripts/acquire-lock.js
- name: Sync database to main branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_PAYLOAD: ${{ toJson(github.event.issue) }}
run: |
node .github/scripts/sync-database.js
- name: Release lock
run: |
node .github/scripts/release-lock.js