-
Notifications
You must be signed in to change notification settings - Fork 178
Add PR size-labeling workflow #821
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
Conversation
This PR size-labeling script came from Cirq.
This workflow is the same as used in Cirq and other Quantumlib repositories.
.github/workflows/pr-labeler.yaml
Outdated
Label pull request ${{github.event.pull_request.number}} by ${{github.actor}} | ||
|
||
on: | ||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be pull_request_target
as in Cirq. We tried with pull_request
and it failed on permissions. pull_request
is also more dangerous, because it runs the workflow with the PR code. pull_request_target
runs the code in master
which has been code-reviewed.
dev_tools/ci/size-labeler.sh
Outdated
|
||
local change_info | ||
local -r keys_filter='with_entries(select([.key] | inside(["changes", "filename"])))' | ||
change_info="$(jq_stdin "map(${keys_filter})" <<<"$(api_call "pulls/${pr}/files")")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this based on an older version of the Cirq size-labeler.sh?
I recall fixing these constructs (cmd <<<"$(api_call ...)"
) which ignore the exit status of the api_call (and run cmd
regardless) for cirq.
Please consider syncing this with the current Cirq script which we know that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use pull_request_target
as in Cirq.
Also the labeling script should be synced with its current Cirq version.
Argh, you're right. I used the copy in the quantumlib/template repo, and evidently I didn't update it after the last set of changes. |
The latest commit updates the version of the script and the workflow. |
This PR size-labeling workflow and script came from Cirq. It makes it so that PRs are automatically labeled with an indication of their size, such as
size: S
orsize: L
.