Browse Source

fix(workflows): use timestamp filter to reliably identify triggered run ID

Using --limit 1 to find the run ID is a race condition if another run
of the same workflow starts concurrently. Capture a timestamp before
dispatching and pass --created >=${before} to gh run list so we
always select the run we just triggered.
pull/4903/head
Daniel Gibbs 1 month ago
parent
commit
13fb400a7b
  1. 4
      .github/workflows/trigger-docker-build.yml

4
.github/workflows/trigger-docker-build.yml

@ -18,11 +18,13 @@ jobs:
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
before=$(date -u +%Y-%m-%dT%H:%M:%SZ)
gh workflow run action-docker-publish.yml --repo GameServerManagers/docker-linuxgsm
sleep 10
run_id=$(gh run list \
--workflow action-docker-publish.yml \
--repo GameServerManagers/docker-linuxgsm \
--created ">=${before}" \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId')
@ -40,11 +42,13 @@ jobs:
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
before=$(date -u +%Y-%m-%dT%H:%M:%SZ)
gh workflow run action-docker-publish.yml --repo GameServerManagers/docker-gameserver
sleep 10
run_id=$(gh run list \
--workflow action-docker-publish.yml \
--repo GameServerManagers/docker-gameserver \
--created ">=${before}" \
--limit 1 \
--json databaseId \
--jq '.[0].databaseId')

Loading…
Cancel
Save