Skip to content

Fix detection of the ci/no-release label in a push event#7917

Merged
pavoljuhas merged 2 commits intoquantumlib:mainfrom
pavoljuhas:skip-release-for-ci/no-release-label
Mar 2, 2026
Merged

Fix detection of the ci/no-release label in a push event#7917
pavoljuhas merged 2 commits intoquantumlib:mainfrom
pavoljuhas:skip-release-for-ci/no-release-label

Conversation

@pavoljuhas
Copy link
Collaborator

@pavoljuhas pavoljuhas commented Feb 27, 2026

The release-main workflow is triggered by "push" event which
does not carry github.event.pull_request.labels.
Here we use the GitHub CLI instead to lookup the PR from commit and
check if it has the "ci/no-release" label.
Note gh pr list --search=COMMIT may give several matches hence
the extra check with grep "${GITHUB_SHA}".

Follow-up to #7915

The release-main workflow is triggered by "push" event which
does not carry `github.event.pull_request.labels`.
Here we switch to GitHub CLI to lookup the PR from commit and
test for the "ci/no-release" label.
Note `gh pr list --search=COMMIT` may give several matches hence
the extra check with `grep "${GITHUB_SHA}"`.

Follow-up to quantumlib#7915
@pavoljuhas pavoljuhas requested review from a team and vtomole as code owners February 27, 2026 01:28
@github-actions github-actions bot added the Size: XS <10 lines changed label Feb 27, 2026
@pavoljuhas pavoljuhas requested a review from mhucka February 27, 2026 01:30
@pavoljuhas pavoljuhas added the ci/no-release Use this label for pull request that should not have Cirq pre-release on PyPI. label Feb 27, 2026
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.62%. Comparing base (bf22232) to head (65f9096).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7917      +/-   ##
==========================================
- Coverage   99.62%   99.62%   -0.01%     
==========================================
  Files        1104     1104              
  Lines       99375    99375              
==========================================
- Hits        99000    98999       -1     
- Misses        375      376       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mhucka mhucka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial nits, optional. Otherwise LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyPiPyPI

Possibly the most trivial nit of all time.

if gh pr list --state=merged --search="${GITHUB_SHA}" --label=ci/no-release \
--json=mergeCommit --jq=".[].mergeCommit.oid" | grep -q "${GITHUB_SHA}";
then
echo "The PR has ci/no-release label - skipping the release"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "The PR has ci/no-release label - skipping the release"
echo "The PR has a ci/no-release label - skipping the release"

@github-actions github-actions bot added size: S 10< lines changed <50 and removed Size: XS <10 lines changed labels Mar 2, 2026
@pavoljuhas
Copy link
Collaborator Author

Trivial nits, optional. Otherwise LGTM.

Thanks for catching those, done in 65f9096

@pavoljuhas pavoljuhas enabled auto-merge March 2, 2026 20:11
@pavoljuhas pavoljuhas added this pull request to the merge queue Mar 2, 2026
Merged via the queue into quantumlib:main with commit f71191e Mar 2, 2026
39 checks passed
@pavoljuhas pavoljuhas deleted the skip-release-for-ci/no-release-label branch March 2, 2026 20:25
pavoljuhas added a commit to pavoljuhas/Cirq that referenced this pull request Mar 2, 2026
Problem: `gh pr list --state=merged` may not find the pull request
due to race condition at its push event.

Solution: Extract pull request number from the commit subject and
look up its labels directly.

Follow-up to quantumlib#7917
github-merge-queue bot pushed a commit that referenced this pull request Mar 3, 2026
Problem: `gh pr list --state=merged` may not find the pull request
due to race condition at its push event time.

Solution: Extract pull request number from the commit subject and
look up its labels directly.

Follow-up to #7917
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Mar 3, 2026
Problem: `gh pr list --state=merged` may not find the pull request
due to race condition at its push event time.

Solution: Extract pull request number from the commit subject and
look up its labels directly.

Follow-up to quantumlib#7917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/no-release Use this label for pull request that should not have Cirq pre-release on PyPI. size: S 10< lines changed <50

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants