CI: a rerun of a main run no longer fails on its own deploy tag
CI / Test (jest) (pull_request) Successful in 22s
CI / Security (npm audit) (pull_request) Successful in 30s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m18s
CI / Integration (api) (pull_request) Successful in 2m16s
CI / UI screenshots (before/after) (pull_request) Successful in 15s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / Test (jest) (pull_request) Successful in 22s
CI / Security (npm audit) (pull_request) Successful in 30s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m18s
CI / Integration (api) (pull_request) Successful in 2m16s
CI / UI screenshots (before/after) (pull_request) Successful in 15s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
A rerun keeps its run number, so "Tag deployed commit" tried to create deploy-<date>-<run> again, got a conflict, and failed the Deploy job after a successful deploy, which also skipped Deploy worker. The step now accepts an existing tag when it marks the same commit, and fails with the details when it marks another. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
567941cec4
commit
16a93f02be
1 file changed
+11
-2
+11
-2
@@ -319,11 +319,20 @@ jobs:
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
TAG="deploy-$(date -u +%Y.%m.%d)-${RUN_NUMBER}"
|
||||
curl -sf -X POST \
|
||||
API="https://code.lotusguild.org/api/v1/repos/${REPO}/tags"
|
||||
code=$(curl -s -o /tmp/tag.json -w '%{http_code}' -X POST \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target\":\"${GIT_SHA}\",\"message\":\"Deployed to production\"}" \
|
||||
"https://code.lotusguild.org/api/v1/repos/${REPO}/tags"
|
||||
"$API")
|
||||
if [ "$code" = 201 ]; then echo "Tagged ${GIT_SHA} as ${TAG}"; exit 0; fi
|
||||
# A rerun keeps its run number, so the tag can already exist: fine if it is
|
||||
# this commit's, an error if it names another.
|
||||
existing=$(curl -sf -H "Authorization: token $GITHUB_TOKEN" "$API/${TAG}" \
|
||||
| node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{try{console.log(JSON.parse(d).commit.sha)}catch(e){}})')
|
||||
if [ "$existing" = "$GIT_SHA" ]; then echo "${TAG} already marks ${GIT_SHA} (a rerun)"; exit 0; fi
|
||||
echo "Could not tag ${GIT_SHA} as ${TAG} (HTTP ${code}; existing: ${existing:-none})"
|
||||
cat /tmp/tag.json; exit 1
|
||||
|
||||
deploy-worker:
|
||||
name: Deploy worker
|
||||
|
||||
Reference in new issue
Block a user