-
Notifications
You must be signed in to change notification settings - Fork 526
56 lines (50 loc) · 1.73 KB
/
check_author.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
name: Check Author
on:
pull_request_target:
types: [opened, synchronize]
jobs:
get-delivery-files:
runs-on: ubuntu-latest
outputs:
filenames: ${{ steps.files.outputs.added }}
steps:
- name: Get filenames of any deliveries being added
id: files
uses: Ana06/[email protected]
with:
format: 'json'
filter: |
deliveries/*.md
maintenance_deliveries/*.md
check_author:
runs-on: ubuntu-latest
needs: get-delivery-files
if: needs.get-delivery-files.outputs.filenames != '[]'
strategy:
fail-fast: false
matrix:
filename: ${{ fromJson(needs.get-delivery-files.outputs.filenames) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Parse delivery file
id: parse-delivery
uses: w3f/parse-milestone-delivery-action@master
with:
path: "${{ github.workspace }}/${{ matrix.filename }}"
- name: Find PR author in application authors
uses: actions/github-script@v5
env:
pr_author: ${{ github.event.pull_request.user.login }}
with:
script: |
await github.rest.repos.listCommits({
owner: 'w3f',
repo: 'Grants-Program',
path: 'applications/${{ steps.parse-delivery.outputs.application_document }}'
}).then( app_commits => {
app_authors = app_commits.data.map(c => {return c.author.login});
if(!app_authors.includes(process.env.pr_author))
core.setFailed('PR author does not match any application author.');
});