]> git.ipfire.org Git - thirdparty/systemd.git/blob - .github/workflows/development_freeze.yml
build(deps): bump actions/checkout from 4.1.0 to 4.1.1
[thirdparty/systemd.git] / .github / workflows / development_freeze.yml
1 # doc: https://github.com/redhat-plumbers-in-action/devel-freezer#readme
2 ---
3
4 name: Development Freeze
5 on:
6 workflow_run:
7 workflows: [ Gather Pull Request Metadata ]
8 types:
9 - completed
10
11 env:
12 PULL_REQUEST_METADATA_DIR: pull_request
13 PULL_REQUEST_METADATA_FILE: metadata
14
15 permissions:
16 contents: read
17
18 jobs:
19 freezer:
20 if: >
21 github.event.workflow_run.event == 'pull_request' &&
22 github.event.workflow_run.conclusion == 'success' &&
23 github.repository == 'systemd/systemd'
24 runs-on: ubuntu-22.04
25
26 permissions:
27 pull-requests: write
28
29 steps:
30 - name: Download Pull Request Metadata artifact
31 uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
32 with:
33 script: |
34 const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
35 owner: context.repo.owner,
36 repo: context.repo.repo,
37 run_id: ${{ github.event.workflow_run.id }},
38 });
39
40 const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
41 return artifact.name == "${{ env.PULL_REQUEST_METADATA_FILE }}"
42 })[0];
43
44 const download = await github.rest.actions.downloadArtifact({
45 owner: context.repo.owner,
46 repo: context.repo.repo,
47 artifact_id: matchArtifact.id,
48 archive_format: 'zip',
49 });
50
51 const fs = require('fs');
52 fs.writeFileSync('${{ github.workspace }}/${{ env.PULL_REQUEST_METADATA_FILE }}.zip', Buffer.from(download.data));
53
54 - run: unzip ${{ env.PULL_REQUEST_METADATA_FILE }}.zip
55
56 - name: 'Get Pull Request number'
57 uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
58 with:
59 github-token: ${{ secrets.GITHUB_TOKEN }}
60 script: |
61 const fs = require('fs');
62 const pr_number = Number(fs.readFileSync('./${{ env.PULL_REQUEST_METADATA_FILE }}'));
63 core.exportVariable('pr_number', pr_number);
64
65 - name: Repository checkout
66 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
67 with:
68 fetch-depth: 0
69
70 - name: Development Freezer
71 uses: redhat-plumbers-in-action/devel-freezer@13b6551f19ade74ca79be4cab06b815a4ffffa64
72 with:
73 pr-number: ${{ env.pr_number }}
74 token: ${{ secrets.GITHUB_TOKEN }}