-
Notifications
You must be signed in to change notification settings - Fork 62
fix(ci): record and use the PR number to post the comment #286
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
base: main
Are you sure you want to change the base?
Changes from all commits
65852dd
79e398c
2658af1
3d374f4
95a488d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,32 @@ jobs: | |
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: benchmark-report | ||
| path: benchmark-report.txt | ||
| path: benchmark-report.md | ||
| github-token: ${{ secrets.ROCKSBOT_CHISEL_PR_COMMENTER }} | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
|
|
||
| - name: Get PR number | ||
| id: get-pr-number | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ROCKSBOT_CHISEL_PR_COMMENTER }} | ||
| # The branch name is considered an untrusted input value (under the | ||
| # contributor's control), so store it in a variable to avoid shell | ||
| # injection. | ||
| # In the unlikely case where multiple PRs, on the same branch, from the | ||
| # same author exists, the most recent one is selected. | ||
| QUERY_PR: "head:${{ github.event.workflow_run.head_branch }} sort:updated-desc author:${{ github.event.workflow_run.head_repository.owner.login }} ${{ github.event.workflow_run.head_sha }}" | ||
| # Filters and formats the JSON into a `key=value` string with basic error handling. | ||
| JQ_FILTER: >- | ||
| .[0] | ||
| | if (.number == null) then error("Cannot find PR number") end | ||
| | "number=\(.number)" | ||
| run: | | ||
| gh pr list --repo "${{ github.repository }}" --state all --search "${QUERY_PR}" \ | ||
|
upils marked this conversation as resolved.
|
||
| --json number --jq "${JQ_FILTER}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| - name: Post message to PR | ||
| uses: mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8 | ||
| uses: mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8 # v2 | ||
| with: | ||
| message-path: benchmark-report.txt | ||
| issue: ${{ github.event.workflow_run.pull_requests[0].number }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for context of this removal for anyone interested,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm missing something the context for this PR... how come we have the PR at hand and not the number? This whole workflow is conditioning on I realize that this is all being done in the name of security, but the amout of fiddling with stuff that supposedly should be simple really makes it feel like we'll see more serious issues soon.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This workflow is triggered by the other one and is receiving a |
||
| message-path: benchmark-report.md | ||
| issue: ${{ steps.get-pr-number.outputs.number }} | ||
| repo-token: ${{ secrets.ROCKSBOT_CHISEL_PR_COMMENTER }} | ||
Uh oh!
There was an error while loading. Please reload this page.