Skip to content

Commit 11c77bb

Browse files
committed
Replace delete-artifact action with REST api calls using gh CLI
1 parent b53dd61 commit 11c77bb

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,14 +2651,23 @@ jobs:
26512651
steps:
26522652

26532653
- name: Delete Workspace Artifact
2654-
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
2655-
with:
2656-
name: build.tar.zst
2657-
useGlob: false
2654+
run: |
2655+
ARTIFACT_ID=$(gh api /repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts --jq ".artifacts[] | select(.name == \"${NAME}\") | .id")
2656+
echo ${ARTIFACT_ID}
2657+
if [ -n "$ARTIFACT_ID" ]; then
2658+
gh api /repos/${GITHUB_REPOSITORY}/actions/artifacts/${ARTIFACT_ID} -X DELETE
2659+
fi
2660+
env:
2661+
GH_TOKEN: ${{ github.token }}
2662+
NAME: build.tar.zst
26582663

26592664
- name: Delete Dev Build Artifact
2660-
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
26612665
if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && cancelled() }}
2662-
with:
2663-
name: dev-build_${{github.event.pull_request.number || github.run_id}}.zip
2664-
useGlob: false
2666+
run: |
2667+
ARTIFACT_ID=$(gh api /repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts --jq ".artifacts[] | select(.name == \"${NAME}\") | .id")
2668+
if [ -n "$ARTIFACT_ID" ]; then
2669+
gh api /repos/${GITHUB_REPOSITORY}/actions/artifacts/${ARTIFACT_ID} -X DELETE
2670+
fi
2671+
env:
2672+
GH_TOKEN: ${{ github.token }}
2673+
NAME: dev-build_${{github.event.pull_request.number || github.run_id}}.zip

0 commit comments

Comments
 (0)