Skip to content

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

Merged
merged 4 commits into from
Jun 30, 2025
Merged

Add PR size-labeling workflow #821

merged 4 commits into from
Jun 30, 2025

Conversation

mhucka
Copy link
Collaborator

@mhucka mhucka commented Jun 28, 2025

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 or size: L.

mhucka added 2 commits June 27, 2025 20:22
This PR size-labeling script came from Cirq.
This workflow is the same as used in Cirq and other Quantumlib
repositories.
@mhucka mhucka enabled auto-merge (squash) June 30, 2025 03:00
@mhucka mhucka requested review from pavoljuhas and sergeisakov June 30, 2025 03:00
Label pull request ${{github.event.pull_request.number}} by ${{github.actor}}

on:
pull_request:
Copy link
Collaborator

@pavoljuhas pavoljuhas Jun 30, 2025

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.


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")")"
Copy link
Collaborator

@pavoljuhas pavoljuhas Jun 30, 2025

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.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a 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.

@mhucka
Copy link
Collaborator Author

mhucka commented Jun 30, 2025

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.

@mhucka
Copy link
Collaborator Author

mhucka commented Jun 30, 2025

The latest commit updates the version of the script and the workflow.

@mhucka mhucka requested a review from pavoljuhas June 30, 2025 20:48
@mhucka mhucka merged commit 6999a9f into master Jun 30, 2025
48 checks passed
@mhucka mhucka deleted the mh-add-pr-size-labeler branch June 30, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants