mirror of
https://github.com/openssl/openssl.git
synced 2024-12-27 06:21:43 +08:00
9ad400f788
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15345)
69 lines
2.5 KiB
YAML
69 lines
2.5 KiB
YAML
name: FIPS Changed Label
|
|
on:
|
|
workflow_run:
|
|
workflows: ["FIPS Checksums"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
apply-label:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
|
steps:
|
|
- name: 'Download artifact'
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
uses: actions/github-script@v4
|
|
with:
|
|
script: |
|
|
var artifacts = await github.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 == "fips_checksum"
|
|
})[0];
|
|
var download = await github.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: matchArtifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
var fs = require('fs');
|
|
fs.writeFileSync('${{github.workspace}}/artifact.zip', Buffer.from(download.data));
|
|
- run: unzip artifact.zip
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
- name: 'Check artifact and apply'
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
uses: actions/github-script@v4
|
|
with:
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
script: |
|
|
var fs = require('fs');
|
|
var pr_num = Number(fs.readFileSync('./pr_num'));
|
|
if ( fs.existsSync('./fips_changed') ) {
|
|
github.issues.addLabels({
|
|
issue_number: pr_num,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: ['severity: fips change']
|
|
});
|
|
} else if ( fs.existsSync('./fips_unchanged') ) {
|
|
var labels = await github.issues.listLabelsOnIssue({
|
|
issue_number: pr_num,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
});
|
|
|
|
for ( var label in labels.data ) {
|
|
if (labels.data[label].name == 'severity: fips change') {
|
|
github.issues.removeLabel({
|
|
issue_number: pr_num,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'severity: fips change'
|
|
});
|
|
}
|
|
}
|
|
}
|