Skip to content

Commit c1e73bb

Browse files
cpcloudcursoragent
andcommitted
Use a single checkout for the requested release commit
Checking out the requested SHA once keeps prepare-job checks aligned with the commit being tagged while removing redundant checkout steps. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5141012 commit c1e73bb

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

.github/workflows/release-cuda-pathfinder.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ jobs:
5353
exit 1
5454
fi
5555
56-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57-
with:
58-
fetch-depth: 0
59-
6056
- name: Validate version
6157
id: vars
6258
env:
@@ -74,24 +70,28 @@ jobs:
7470
echo "version=${version}"
7571
} >> "$GITHUB_OUTPUT"
7672
77-
- name: Validate and resolve commit
78-
id: commit
73+
- name: Validate commit input format
7974
env:
8075
COMMIT_INPUT: ${{ inputs.commit }}
81-
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
8276
run: |
8377
# Require a full SHA to avoid ambiguity and accidental releases.
8478
if [[ ! "${COMMIT_INPUT}" =~ ^[0-9a-fA-F]{40}$ ]]; then
8579
echo "::error::Commit must be a full 40-character SHA, got: ${COMMIT_INPUT}"
8680
exit 1
8781
fi
8882
83+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+
with:
85+
fetch-depth: 0
86+
ref: ${{ inputs.commit }}
87+
88+
- name: Validate and resolve commit
89+
id: commit
90+
env:
91+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
92+
run: |
8993
git fetch --no-tags origin "${DEFAULT_BRANCH}"
90-
commit=$(git rev-parse --verify "${COMMIT_INPUT}^{commit}" 2>/dev/null || true)
91-
if [[ -z "${commit}" ]]; then
92-
echo "::error::Commit not found in repository: ${COMMIT_INPUT}"
93-
exit 1
94-
fi
94+
commit=$(git rev-parse --verify "HEAD^{commit}")
9595
9696
if ! git merge-base --is-ancestor "${commit}" "origin/${DEFAULT_BRANCH}"; then
9797
echo "::error::Commit ${commit} is not reachable from origin/${DEFAULT_BRANCH}"
@@ -101,12 +101,6 @@ jobs:
101101
echo "commit=${commit}" >> "$GITHUB_OUTPUT"
102102
echo "Using release commit: ${commit}"
103103
104-
- name: Check out release commit
105-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
106-
with:
107-
fetch-depth: 0
108-
ref: ${{ steps.commit.outputs.commit }}
109-
110104
- name: Check release notes exist
111105
env:
112106
VERSION: ${{ steps.vars.outputs.version }}

0 commit comments

Comments
 (0)