Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/comment-perf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ jobs:

- name: Get PR number
id: get-pr-number
run: |
PR_NUMBER=$(gh api "repos/${{ github.repository }}/pulls?head=${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }}&state=open" --jq '.[0].number')
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
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.
QUERY_PR: "head:${{ github.event.workflow_run.head_branch }} ${{ 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("Could not find PR number") end
| "number=\(.number)"
run: |
gh pr list --repo "${{ github.repository }}" --state all --search "${QUERY_PR}" \
--json number --jq "${JQ_FILTER}" >> "${GITHUB_OUTPUT}"

- name: Post message to PR
uses: mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8 # v2
Expand Down
Loading