Skip to content

Commit 75cbe5b

Browse files
committed
Try automating getting previous run-id
1 parent c66fb58 commit 75cbe5b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/vartest.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ jobs:
1515
test:
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Get Previous Run ID
19+
id: get_id
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: |
23+
# Fetches the ID of the last completed run for the current workflow
24+
PREVIOUS_RUN_ID=$(gh run list --workflow "${{ github.workflow }}" --status completed --limit 1 --json databaseId --jq '.[0].databaseId')
25+
echo "previous_run_id=$PREVIOUS_RUN_ID" >> $GITHUB_OUTPUT
1826
- name: Download test artifact
1927
uses: actions/download-artifact@v8
2028
with:

0 commit comments

Comments
 (0)