mirror of
https://github.com/nlohmann/json.git
synced 2025-11-23 19:34:10 +08:00
Bumps [actions/github-script](https://github.com/actions/github-script) from 7.0.1 to 8.0.0.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](60a0d83039...ed597411d8)
---
updated-dependencies:
- dependency-name: actions/github-script
dependency-version: 8.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
82 lines
2.9 KiB
YAML
82 lines
2.9 KiB
YAML
name: Comment Check Amalgamation
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Check amalgamation"]
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
comment:
|
|
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
issues: read
|
|
pull-requests: write
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: 'Download artifact'
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
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 == "pr"
|
|
})[0];
|
|
var download = await github.rest.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}}/pr.zip', Buffer.from(download.data));
|
|
- run: unzip pr.zip
|
|
|
|
- name: 'Comment on PR'
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
var fs = require('fs');
|
|
const author = fs.readFileSync('./author')
|
|
const issue_number = Number(fs.readFileSync('./number'));
|
|
const opts = github.rest.issues.listForRepo.endpoint.merge({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
creator: author,
|
|
state: 'all'
|
|
})
|
|
let first = true
|
|
const issues = await github.paginate(opts)
|
|
for (const issue of issues) {
|
|
if (issue.number === issue_number) {
|
|
continue
|
|
}
|
|
if (issue.pull_request) {
|
|
first = false
|
|
break
|
|
}
|
|
}
|
|
await github.rest.issues.createComment({
|
|
issue_number: issue_number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: '## 🔴 Amalgamation check failed! 🔴\nThe source code has not been amalgamated.'
|
|
+ (first ? ' @' + author + ' Please read and follow the [Contribution Guidelines]'
|
|
+ '(https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).'
|
|
: '')
|
|
})
|