Skip to content

New Authors Report #4172

New Authors Report

New Authors Report #4172

Workflow file for this run

name: New Authors Report
on:
workflow_run:
workflows: [New Authors Check]
types: [completed]
jobs:
comment:
runs-on: ubuntu-latest
steps:
- run: echo "Author check is complete"
- name: Download artifact new authors
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "new-authors";
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/new-authors.zip`, Buffer.from(download.data));
- run: unzip new-authors.zip
- run: |
if test -s new-authors.txt; then
echo new_authors=yes >> $GITHUB_ENV
fi
- name: Comment on PR
if: ${{ env.new_authors == 'yes' }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync('./pr-number.txt'));
let msg = 'NOTE: This PR may contain new authors.';
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: msg
});