ci(docker): resolve short refs before checkout · openclaw/openclaw@93ac2ce
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -231,10 +231,9 @@ jobs:
|
231 | 231 | selected_sha: ${{ steps.validate.outputs.selected_sha }} |
232 | 232 | trusted_reason: ${{ steps.validate.outputs.trusted_reason }} |
233 | 233 | steps: |
234 | | - - name: Checkout selected ref |
| 234 | + - name: Checkout workflow repository |
235 | 235 | uses: actions/checkout@v6 |
236 | 236 | with: |
237 | | -ref: ${{ inputs.ref }} |
238 | 237 | fetch-depth: 0 |
239 | 238 | |
240 | 239 | - name: Validate selected ref |
@@ -244,12 +243,17 @@ jobs:
|
244 | 243 | shell: bash |
245 | 244 | run: | |
246 | 245 | set -euo pipefail |
247 | | - selected_sha="$(git rev-parse HEAD)" |
248 | 246 | trusted_reason="" |
249 | 247 | |
250 | 248 | git fetch --no-tags origin '+refs/heads/*:refs/remotes/origin/*' |
251 | 249 | git fetch --tags origin '+refs/tags/*:refs/tags/*' |
252 | 250 | |
| 251 | + # Resolve here instead of in actions/checkout so short SHAs work too. |
| 252 | + if ! selected_sha="$(git rev-parse --verify "${INPUT_REF}^{commit}")"; then |
| 253 | + echo "Ref '${INPUT_REF}' could not be resolved to a commit." >&2 |
| 254 | + exit 1 |
| 255 | + fi |
| 256 | + |
253 | 257 | if git merge-base --is-ancestor "$selected_sha" refs/remotes/origin/main; then |
254 | 258 | trusted_reason="main-ancestor" |
255 | 259 | elif git tag --points-at "$selected_sha" | grep -Eq '^v'; then |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,7 @@ describe("test-install-sh-docker", () => {
|
64 | 64 | const workflow = readFileSync(LIVE_E2E_WORKFLOW_PATH, "utf8"); |
65 | 65 | |
66 | 66 | expect(workflow).toContain("git fetch --no-tags origin '+refs/heads/*:refs/remotes/origin/*'"); |
| 67 | +expect(workflow).toContain('git rev-parse --verify "${INPUT_REF}^{commit}"'); |
67 | 68 | expect(workflow).toContain("repository-branch-history"); |
68 | 69 | expect(workflow).toContain("git tag --points-at \"$selected_sha\" | grep -Eq '^v'"); |
69 | 70 | expect(workflow).toContain("reachable from an OpenClaw branch or release tag"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。