Skip to content

Enable fetch-tags in checkout-pytorch to fix release tag detection - #180504

Closed
atalman wants to merge 2 commits into
pytorch:mainfrom
atalman:fix_release_checkout
Closed

atalman wants to merge 2 commits into
pytorch:mainfrom
atalman:fix_release_checkout

Conversation

@atalman

@atalman atalman commented Apr 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Release candidate builds triggered by tags (e.g. v2.12.0-rc1) are incorrectly producing dev nightly versions instead of RC versions.

The root cause is that #172544 added single-branch: true to the checkout-pytorch action when switching from actions/checkout@v4 to pytorch/test-infra/.github/actions/checkout@main. With single-branch: true, git restricts the fetch refspec and tags are no longer fetched — even with fetch-depth: 0.

This causes binary_populate_env.sh to fail at: git describe --tags --match 'v[0-9].[0-9].[0-9]*' --exact
fatal: No names found, cannot describe anything.

and fall through to the dev version path, producing 2.12.0.dev20260415+cpu instead of 2.12.0+cpu.

The fix adds fetch-tags: true to both checkout steps (primary and retry) in the checkout-pytorch action, ensuring tags are explicitly fetched regardless of single-branch mode.

Failing build: https://github.com/pytorch/pytorch/actions/runs/24474783525/job/71524093912

Test plan

  • Verify that a workflow triggered by an RC tag (e.g. v2.12.0-rc1) correctly sets PYTORCH_BUILD_VERSION=2.12.0+cpu instead of
    2.12.0.dev<date>+cpu
  • Verify that nightly builds on the nightly branch are unaffected (they should still produce dev versions)

The addition of `single-branch: true` in pytorch#172544 prevented git tags from
being fetched during checkout. This caused `binary_populate_env.sh` to
fail to detect release candidate tags (e.g. v2.12.0-rc1) via
`git describe --tags --exact`, falling back to dev nightly versions.

Authored with Claude.
@atalman
atalman requested a review from a team as a code owner April 15, 2026 21:22
@pytorch-bot

pytorch-bot Bot commented Apr 15, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/180504

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 136 Pending

As of commit 1ff6a44 with merge base ad0b2d3 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Apr 15, 2026
# --depth=1 for speed, manually fetch history and other refs as necessary
fetch-depth: ${{ inputs.fetch-depth }}
single-branch: true
fetch-tags: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we always want this? Won't this add some overhead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point, let me fetch-tag only on tag event

@atalman atalman added the ciflow/binaries Trigger all binary build and upload jobs on the PR label Apr 15, 2026
Refine the fix to conditionally fetch tags using github.ref_type == 'tag',
avoiding unnecessary tag fetching on regular branch pushes and PRs.

Authored with Claude.
@atalman
atalman requested a review from seemethere April 15, 2026 21:31
@atalman

atalman commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge -f "lint is green, checkout works"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@atalman

atalman commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot cherry-pick --onto release/2.12 -c critical

pytorchbot pushed a commit that referenced this pull request Apr 15, 2026
…180504)

## Summary

  Release candidate builds triggered by tags (e.g. `v2.12.0-rc1`) are incorrectly producing dev nightly versions instead of RC versions.

  The root cause is that #172544 added `single-branch: true` to the `checkout-pytorch` action when switching from `actions/checkout@v4` to `pytorch/test-infra/.github/actions/checkout@main`. With `single-branch: true`, git restricts the fetch refspec and tags are no longer fetched — even with `fetch-depth: 0`.

  This causes `binary_populate_env.sh` to fail at: git describe --tags --match 'v[0-9].[0-9].[0-9]*' --exact
  fatal: No names found, cannot describe anything.

  and fall through to the dev version path, producing `2.12.0.dev20260415+cpu` instead of `2.12.0+cpu`.

  The fix adds `fetch-tags: true` to both checkout steps (primary and retry) in the `checkout-pytorch` action, ensuring tags are explicitly fetched regardless of `single-branch` mode.

  Failing build: https://github.com/pytorch/pytorch/actions/runs/24474783525/job/71524093912

  ## Test plan

  - Verify that a workflow triggered by an RC tag (e.g. `v2.12.0-rc1`) correctly sets `PYTORCH_BUILD_VERSION=2.12.0+cpu` instead of
  `2.12.0.dev<date>+cpu`
  - Verify that nightly builds on the `nightly` branch are unaffected (they should still produce dev versions)
Pull Request resolved: #180504
Approved by: https://github.com/seemethere

(cherry picked from commit ba240c9)
@pytorchbot

Copy link
Copy Markdown
Collaborator

Cherry picking #180504

The cherry pick PR is at #180508 and it is recommended to link a critical cherry pick PR with an issue. The following tracker issues are updated:

Details for Dev Infra team Raised by workflow job

atalman added a commit that referenced this pull request Apr 15, 2026
…180508)

Enable fetch-tags in checkout-pytorch to fix release tag detection (#180504)

## Summary

  Release candidate builds triggered by tags (e.g. `v2.12.0-rc1`) are incorrectly producing dev nightly versions instead of RC versions.

  The root cause is that #172544 added `single-branch: true` to the `checkout-pytorch` action when switching from `actions/checkout@v4` to `pytorch/test-infra/.github/actions/checkout@main`. With `single-branch: true`, git restricts the fetch refspec and tags are no longer fetched — even with `fetch-depth: 0`.

  This causes `binary_populate_env.sh` to fail at: git describe --tags --match 'v[0-9].[0-9].[0-9]*' --exact
  fatal: No names found, cannot describe anything.

  and fall through to the dev version path, producing `2.12.0.dev20260415+cpu` instead of `2.12.0+cpu`.

  The fix adds `fetch-tags: true` to both checkout steps (primary and retry) in the `checkout-pytorch` action, ensuring tags are explicitly fetched regardless of `single-branch` mode.

  Failing build: https://github.com/pytorch/pytorch/actions/runs/24474783525/job/71524093912

  ## Test plan

  - Verify that a workflow triggered by an RC tag (e.g. `v2.12.0-rc1`) correctly sets `PYTORCH_BUILD_VERSION=2.12.0+cpu` instead of
  `2.12.0.dev<date>+cpu`
  - Verify that nightly builds on the `nightly` branch are unaffected (they should still produce dev versions)
Pull Request resolved: #180504
Approved by: https://github.com/seemethere

(cherry picked from commit ba240c9)

Co-authored-by: atalman <[email protected]>
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…ytorch#180504)

## Summary

  Release candidate builds triggered by tags (e.g. `v2.12.0-rc1`) are incorrectly producing dev nightly versions instead of RC versions.

  The root cause is that pytorch#172544 added `single-branch: true` to the `checkout-pytorch` action when switching from `actions/checkout@v4` to `pytorch/test-infra/.github/actions/checkout@main`. With `single-branch: true`, git restricts the fetch refspec and tags are no longer fetched — even with `fetch-depth: 0`.

  This causes `binary_populate_env.sh` to fail at: git describe --tags --match 'v[0-9].[0-9].[0-9]*' --exact
  fatal: No names found, cannot describe anything.

  and fall through to the dev version path, producing `2.12.0.dev20260415+cpu` instead of `2.12.0+cpu`.

  The fix adds `fetch-tags: true` to both checkout steps (primary and retry) in the `checkout-pytorch` action, ensuring tags are explicitly fetched regardless of `single-branch` mode.

  Failing build: https://github.com/pytorch/pytorch/actions/runs/24474783525/job/71524093912

  ## Test plan

  - Verify that a workflow triggered by an RC tag (e.g. `v2.12.0-rc1`) correctly sets `PYTORCH_BUILD_VERSION=2.12.0+cpu` instead of
  `2.12.0.dev<date>+cpu`
  - Verify that nightly builds on the `nightly` branch are unaffected (they should still produce dev versions)
Pull Request resolved: pytorch#180504
Approved by: https://github.com/seemethere
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…ytorch#180504)

## Summary

  Release candidate builds triggered by tags (e.g. `v2.12.0-rc1`) are incorrectly producing dev nightly versions instead of RC versions.

  The root cause is that pytorch#172544 added `single-branch: true` to the `checkout-pytorch` action when switching from `actions/checkout@v4` to `pytorch/test-infra/.github/actions/checkout@main`. With `single-branch: true`, git restricts the fetch refspec and tags are no longer fetched — even with `fetch-depth: 0`.

  This causes `binary_populate_env.sh` to fail at: git describe --tags --match 'v[0-9].[0-9].[0-9]*' --exact
  fatal: No names found, cannot describe anything.

  and fall through to the dev version path, producing `2.12.0.dev20260415+cpu` instead of `2.12.0+cpu`.

  The fix adds `fetch-tags: true` to both checkout steps (primary and retry) in the `checkout-pytorch` action, ensuring tags are explicitly fetched regardless of `single-branch` mode.

  Failing build: https://github.com/pytorch/pytorch/actions/runs/24474783525/job/71524093912

  ## Test plan

  - Verify that a workflow triggered by an RC tag (e.g. `v2.12.0-rc1`) correctly sets `PYTORCH_BUILD_VERSION=2.12.0+cpu` instead of
  `2.12.0.dev<date>+cpu`
  - Verify that nightly builds on the `nightly` branch are unaffected (they should still produce dev versions)
Pull Request resolved: pytorch#180504
Approved by: https://github.com/seemethere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries Trigger all binary build and upload jobs on the PR Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants