Skip to content

Full git fetch on tag pushes so macOS release wheel builds detect the tag - #187139

Closed
atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:fix-macos-binary-tag-fetch
Closed

atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:fix-macos-binary-tag-fetch

Conversation

@atalman

@atalman atalman commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

Same issue as #187058, but for the macOS arm64 binary wheel build. The wheel-build job checks out a pinned commit SHA with the default shallow actions/checkout (depth 1, no tags). On a release tag push (e.g. v2.13.0-rc1) the tag ref is never written into that checkout, so tagged_version() in .ci/pytorch/binary_populate_env.sh (git describe --tags --exact, invoked per-iteration by .ci/wheel/build_all_macos_wheels.sh) fails. The build then falls through to the <version>.dev<DATE> default, producing wheels versioned 2.13.0.devYYYYMMDD instead of the release version.

Fix

Do a full fetch (fetch-depth: 0) on tag pushes and keep the shallow checkout for nightlies:

fetch-depth: ${{ github.ref_type != 'tag' && 1 || 0 }}
fetch-tags: ${{ github.ref_type == 'tag' }}

The condition is negated (matching #187058) because GitHub Actions has no ternary and the A && B || C idiom only works when B is truthy; the naive github.ref_type == 'tag' && 0 || 2 always yields the shallow value because 0 is falsy.

Only the wheel-build checkout is changed; the libtorch *-extract job uses a sparse checkout of the already-built wheel artifact and does not need the tag.

Needs to be cherry-picked onto release/2.13 for the RC builds to pick it up.

Test Plan

Regenerated the workflows from the template and confirmed only the macOS wheel workflow changed, with the conditional fetch on the build job's checkout:

python3 .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows

Validated the regenerated YAML parses and passes actionlint (the only reported shellcheck warning, SC2086 on uv python install $DESIRED_PYTHONS, is pre-existing and unrelated):

python3 -c "import yaml; yaml.safe_load(open('.github/workflows/generated-macos-arm64-binary-wheel-nightly.yml'))"
lintrunner --take ACTIONLINT .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml

This PR was authored with the assistance of an AI coding agent.

… tag

Same issue as pytorch#187058, but for the macOS arm64 binary wheel build. The
wheel-build job checks out a pinned commit SHA with the default shallow
checkout and no tags. On a release tag push (e.g. v2.13.0-rc1) the tag ref is
never written into that checkout, so tagged_version() in
.ci/pytorch/binary_populate_env.sh (`git describe --tags --exact`, invoked by
.ci/wheel/build_all_macos_wheels.sh) fails. The build then falls through to the
`<version>.dev<DATE>` default, producing wheels versioned `2.13.0.devYYYYMMDD`
instead of the release version.

Do a full fetch (fetch-depth: 0) on tag pushes and keep the shallow checkout for
nightlies:

  fetch-depth: ${{ github.ref_type != 'tag' && 1 || 0 }}
  fetch-tags: ${{ github.ref_type == 'tag' }}

The condition is negated (matching pytorch#187058) because GitHub Actions has no
ternary and the `A && B || C` idiom only works when B is truthy; the naive
`github.ref_type == 'tag' && 0 || 2` always yields the shallow value because
`0` is falsy. Only the wheel-build checkout is changed; the libtorch extract
job uses a sparse checkout of the already-built wheel and does not need the tag.

Test Plan:
Regenerated the workflows from the template and confirmed only the macOS
wheel workflow changed, with the conditional fetch on the build job's checkout:

```
python3 .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows
```

Validated the regenerated YAML parses and passes actionlint (the only reported
shellcheck warning, SC2086 on `uv python install $DESIRED_PYTHONS`, is
pre-existing and unrelated):

```
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/generated-macos-arm64-binary-wheel-nightly.yml'))"
lintrunner --take ACTIONLINT .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

This PR was authored with the assistance of an AI coding agent.
@atalman
atalman requested a review from a team as a code owner June 12, 2026 02:42
@pytorch-bot

pytorch-bot Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 77 Pending

As of commit 83cdaab with merge base 9efe9b4 (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 Jun 12, 2026
@malfet malfet added the ciflow/binaries Trigger all binary build and upload jobs on the PR label Jun 12, 2026
@malfet

malfet commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Don't you need to do the same but for Windows?

@malfet

malfet commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -f "Lint is green, binary workflows have started"

@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 Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

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

@pytorchbot

Copy link
Copy Markdown
Collaborator

Cherry picking #187139

The cherry pick PR is at #187172 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 Jun 12, 2026
… tag (#187172)

Full git fetch on tag pushes so macOS release wheel builds detect the tag (#187139)

## Problem

Same issue as #187058, but for the **macOS arm64 binary wheel** build. The `wheel-build` job checks out a pinned commit SHA with the default shallow `actions/checkout` (depth 1, no tags). On a release tag push (e.g. `v2.13.0-rc1`) the tag ref is never written into that checkout, so `tagged_version()` in `.ci/pytorch/binary_populate_env.sh` (`git describe --tags --exact`, invoked per-iteration by `.ci/wheel/build_all_macos_wheels.sh`) fails. The build then falls through to the `<version>.dev<DATE>` default, producing wheels versioned `2.13.0.devYYYYMMDD` instead of the release version.

## Fix

Do a full fetch (`fetch-depth: 0`) on tag pushes and keep the shallow checkout for nightlies:

```yaml
fetch-depth: ${{ github.ref_type != 'tag' && 1 || 0 }}
fetch-tags: ${{ github.ref_type == 'tag' }}
```

The condition is negated (matching #187058) because GitHub Actions has no ternary and the `A && B || C` idiom only works when `B` is truthy; the naive `github.ref_type == 'tag' && 0 || 2` always yields the shallow value because `0` is falsy.

Only the `wheel-build` checkout is changed; the libtorch `*-extract` job uses a sparse checkout of the already-built wheel artifact and does not need the tag.

> Needs to be cherry-picked onto `release/2.13` for the RC builds to pick it up.

## Test Plan

Regenerated the workflows from the template and confirmed only the macOS wheel workflow changed, with the conditional fetch on the build job's checkout:

```
python3 .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows
```

Validated the regenerated YAML parses and passes actionlint (the only reported shellcheck warning, `SC2086` on `uv python install $DESIRED_PYTHONS`, is pre-existing and unrelated):

```
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/generated-macos-arm64-binary-wheel-nightly.yml'))"
lintrunner --take ACTIONLINT .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

*This PR was authored with the assistance of an AI coding agent.*
Pull Request resolved: #187139
Approved by: https://github.com/malfet

(cherry picked from commit fb17c34)

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

## Problem

Same issue as pytorch#187058, but for the **macOS arm64 binary wheel** build. The `wheel-build` job checks out a pinned commit SHA with the default shallow `actions/checkout` (depth 1, no tags). On a release tag push (e.g. `v2.13.0-rc1`) the tag ref is never written into that checkout, so `tagged_version()` in `.ci/pytorch/binary_populate_env.sh` (`git describe --tags --exact`, invoked per-iteration by `.ci/wheel/build_all_macos_wheels.sh`) fails. The build then falls through to the `<version>.dev<DATE>` default, producing wheels versioned `2.13.0.devYYYYMMDD` instead of the release version.

## Fix

Do a full fetch (`fetch-depth: 0`) on tag pushes and keep the shallow checkout for nightlies:

```yaml
fetch-depth: ${{ github.ref_type != 'tag' && 1 || 0 }}
fetch-tags: ${{ github.ref_type == 'tag' }}
```

The condition is negated (matching pytorch#187058) because GitHub Actions has no ternary and the `A && B || C` idiom only works when `B` is truthy; the naive `github.ref_type == 'tag' && 0 || 2` always yields the shallow value because `0` is falsy.

Only the `wheel-build` checkout is changed; the libtorch `*-extract` job uses a sparse checkout of the already-built wheel artifact and does not need the tag.

> Needs to be cherry-picked onto `release/2.13` for the RC builds to pick it up.

## Test Plan

Regenerated the workflows from the template and confirmed only the macOS wheel workflow changed, with the conditional fetch on the build job's checkout:

```
python3 .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows
```

Validated the regenerated YAML parses and passes actionlint (the only reported shellcheck warning, `SC2086` on `uv python install $DESIRED_PYTHONS`, is pre-existing and unrelated):

```
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/generated-macos-arm64-binary-wheel-nightly.yml'))"
lintrunner --take ACTIONLINT .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

*This PR was authored with the assistance of an AI coding agent.*
Pull Request resolved: pytorch#187139
Approved by: https://github.com/malfet
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
… tag (pytorch#187139)

## Problem

Same issue as pytorch#187058, but for the **macOS arm64 binary wheel** build. The `wheel-build` job checks out a pinned commit SHA with the default shallow `actions/checkout` (depth 1, no tags). On a release tag push (e.g. `v2.13.0-rc1`) the tag ref is never written into that checkout, so `tagged_version()` in `.ci/pytorch/binary_populate_env.sh` (`git describe --tags --exact`, invoked per-iteration by `.ci/wheel/build_all_macos_wheels.sh`) fails. The build then falls through to the `<version>.dev<DATE>` default, producing wheels versioned `2.13.0.devYYYYMMDD` instead of the release version.

## Fix

Do a full fetch (`fetch-depth: 0`) on tag pushes and keep the shallow checkout for nightlies:

```yaml
fetch-depth: ${{ github.ref_type != 'tag' && 1 || 0 }}
fetch-tags: ${{ github.ref_type == 'tag' }}
```

The condition is negated (matching pytorch#187058) because GitHub Actions has no ternary and the `A && B || C` idiom only works when `B` is truthy; the naive `github.ref_type == 'tag' && 0 || 2` always yields the shallow value because `0` is falsy.

Only the `wheel-build` checkout is changed; the libtorch `*-extract` job uses a sparse checkout of the already-built wheel artifact and does not need the tag.

> Needs to be cherry-picked onto `release/2.13` for the RC builds to pick it up.

## Test Plan

Regenerated the workflows from the template and confirmed only the macOS wheel workflow changed, with the conditional fetch on the build job's checkout:

```
python3 .github/scripts/generate_ci_workflows.py
git diff --stat .github/workflows
```

Validated the regenerated YAML parses and passes actionlint (the only reported shellcheck warning, `SC2086` on `uv python install $DESIRED_PYTHONS`, is pre-existing and unrelated):

```
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/generated-macos-arm64-binary-wheel-nightly.yml'))"
lintrunner --take ACTIONLINT .github/workflows/generated-macos-arm64-binary-wheel-nightly.yml
```

*This PR was authored with the assistance of an AI coding agent.*
Pull Request resolved: pytorch#187139
Approved by: https://github.com/malfet
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