Skip to content

LiisaPortfolioTracker_2 #1355

LiisaPortfolioTracker_2

LiisaPortfolioTracker_2 #1355

Workflow file for this run

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@v4
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: |
const app_commits = await github.rest.repos.listCommits({
owner: 'w3f',
repo: 'Grants-Program',
path: 'applications/${{ steps.parse-delivery.outputs.application_document }}'
});
const app_authors = app_commits.data.map(c => c.author.login);
console.log(app_authors);
if (!app_authors.includes(process.env.pr_author)) {
core.setFailed('PR author does not match any application author.');
}