QSTN - Milestone 1 (Delivery).md #985
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | |
}); |