-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: Safe commenting on PRs This generalizes and refactors what the QNS workflow did. * Test * Add missing file * Finalize * Fixes * While I'm here, make `actionlint` happy * Fix * Can't quote BUILD_TYPE * Can't quote CONFIG_PATH * Condition is already in called action * Proper quoting for backslashes * Windows again * Finalize
- Loading branch information
1 parent
b4fd413
commit 532dcc5
Showing
7 changed files
with
142 additions
and
83 deletions.
There are no files selected for viewing
This file contains 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,37 @@ | ||
name: 'Export data for PR comment' | ||
description: 'Exports the neccessary data to post a PR comment securely.' | ||
|
||
# This action might be running off of a fork and would thus not have write | ||
# permissions on the origin repository. In order to allow a separate | ||
# priviledged action to post a comment on a pull request, upload the | ||
# necessary metadata. | ||
|
||
inputs: | ||
name: | ||
description: 'A unique name for the artifact used for exporting.' | ||
required: true | ||
contents: | ||
description: 'A filename with a comment (in Markdown) to be added to the PR.' | ||
required: true | ||
log-url: | ||
description: 'A URL to a log to be linked from the PR comment.' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- if: github.event_name == 'pull_request' | ||
shell: bash | ||
run: | | ||
mkdir comment-data | ||
cp "${{ inputs.contents }}" comment-data/contents | ||
echo "${{ inputs.name }}" > comment-data/name | ||
echo "${{ inputs.log-url }}" > comment-data/log-url | ||
echo "${{ github.event.number }}" > comment-data/pr-number | ||
- if: github.event_name == 'pull_request' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.name }} | ||
path: comment-data | ||
retention-days: 1 |
This file contains 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,29 @@ | ||
name: 'Comment on PR' | ||
description: 'Post a PR comment securely.' | ||
|
||
inputs: | ||
name: | ||
description: 'Artifact name to import comment data from.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
run-id: ${{ github.event.workflow_run.id }} | ||
name: ${{ inputs.name }} | ||
|
||
- id: pr-number | ||
shell: bash | ||
run: echo "number=$(cat pr-number)" >> "$GITHUB_OUTPUT" | ||
|
||
- shell: bash | ||
run: | | ||
[ -s log-url ] && echo "" >> contents && echo "[:arrow_down: Download logs]($(cat log-url))" >> contents | ||
- uses: thollander/actions-comment-pull-request@v2 | ||
with: | ||
filePath: contents | ||
pr_number: ${{ steps.pr-number.outputs.number }} | ||
comment_tag: ${{ inputs.name }}-comment |
This file contains 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 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,24 @@ | ||
# Post test results as pull request comment. | ||
# | ||
# This is done as a separate workflow as it requires write permissions. The | ||
# tests itself might run off of a fork, i.e., an untrusted environment and should | ||
# thus not be granted write permissions. | ||
|
||
name: Benchmark Comment | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Bench"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' | ||
steps: | ||
- uses: ./.github/actions/pr-comment | ||
with: | ||
name: bench |
This file contains 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 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 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