Skip to content

Pull Request / Run Checks #57

Pull Request / Run Checks

Pull Request / Run Checks #57

name: "Pull Request / Run Checks"
on:
workflow_run:
workflows:
- "Pull Request / Labeled: Vetted"
types:
- completed
permissions:
checks: write
jobs:
check:
name: "Maintainer Approval"
runs-on: ubuntu-latest
steps:
- name: 'Retrieve Pull Request Details'
uses: actions/github-script@v6
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 == "pr_details"
})[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}/pr_details.zip`, Buffer.from(download.data));
- name: 'Extract Pull Request Details'
run: unzip pr_details.zip
- uses: actions/github-script@v6
with:
script: |
let fs = require('fs');
let pr_sha = fs.readFileSync('./pr_sha', 'utf8');
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: pr_sha,
name: "Composer Normalize",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "Composer Validate",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.sha,
name: "PEST",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "PHP CS Fixer",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "PHPStan",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "Psalm",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "Rector",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "Semgrep",
status: "in_progress"
});
- uses: actions/github-script@v6
with:
script: |
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.payload.workflow_run.head_sha,
name: "Snyk",
status: "in_progress"
});