-
Notifications
You must be signed in to change notification settings - Fork 34
chore(ci): move trusted workflows to RunsOn #1921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: License Header Comment | ||
|
|
||
| on: | ||
| # zizmor: ignore[dangerous-triggers] This job uses only API metadata and never runs triggering-workflow code. | ||
| workflow_run: | ||
| workflows: [License Header Check] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| comment-on-pr: | ||
| name: Comment on missing license headers | ||
| if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} | ||
| runs-on: ubuntu-latest | ||
| # Read the triggering job result and post the matching pull request notice. | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Comment on PR if headers are missing | ||
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 | ||
| with: | ||
| script: | | ||
| const workflowRun = context.payload.workflow_run | ||
| const pullRequest = workflowRun.pull_requests[0] | ||
|
|
||
| if (!pullRequest) { | ||
| core.notice('No pull request is associated with this workflow run') | ||
| return | ||
| } | ||
|
|
||
| const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| run_id: workflowRun.id, | ||
| per_page: 100, | ||
| }) | ||
| const licenseJob = jobs.find((job) => job.name === 'Check SPDX License Headers') | ||
| const failureStep = licenseJob?.steps?.find( | ||
| (step) => step.name === 'Fail job if headers are missing (PR only)', | ||
| ) | ||
|
|
||
| if (failureStep?.conclusion !== 'failure') { | ||
| core.notice('The license header failure step did not fail; no comment is needed') | ||
| return | ||
| } | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| issue_number: pullRequest.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: `❌ **License Header Check Failed** | ||
|
|
||
| Some files are missing the required SPDX license header. Please add the following header to the beginning of all \`.js\`, \`.jsx\`, \`.nr\`, \`.rs\`, \`.sol\`, \`.ts\`, and \`.tsx\` files: | ||
|
|
||
| \`\`\` | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
| // | ||
| // This file is provided WITHOUT ANY WARRANTY; | ||
| // without even the implied warranty of MERCHANTABILITY | ||
| // or FITNESS FOR A PARTICULAR PURPOSE. | ||
| \`\`\` | ||
|
|
||
| You can run \`./scripts/check-license-headers.sh --fix\` locally to automatically add missing headers, then commit the changes. | ||
|
|
||
| Or run \`./scripts/check-license-headers.sh\` to see which files need headers.`, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.