Skip to content

Development Freeze #142

Development Freeze

Development Freeze #142

---
name: Development Freeze
on:
workflow_run:
workflows: [ Gather Pull Request Metadata ]
types:
- completed
env:
PULL_REQUEST_METADATA_DIR: pull_request
PULL_REQUEST_METADATA_FILE: metadata
permissions:
contents: read
jobs:
freezer:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Download Pull Request Metadata artifact
uses: actions/github-script@v6
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "${{ env.PULL_REQUEST_METADATA_FILE }}"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/${{ env.PULL_REQUEST_METADATA_FILE }}.zip', Buffer.from(download.data));
- run: unzip ${{ env.PULL_REQUEST_METADATA_FILE }}.zip
- name: 'Get Pull Request number'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const pr_number = Number(fs.readFileSync('./${{ env.PULL_REQUEST_METADATA_FILE }}'));
core.exportVariable('pr_number', pr_number);
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Repository checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Development Freezer
uses: ./
with:
pr-number: ${{ env.pr_number }}
token: ${{ secrets.GITHUB_TOKEN }}
...