-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fc8aea
commit 8dd3f5b
Showing
56 changed files
with
1,341 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Delete the artifact if it exists | ||
description: Delete an artifact by its name if it exists. 'actions/upload-artifact@v4' usually removes artifacts itself when restarting jobs. | ||
inputs: | ||
artifact: | ||
description: Any name of artifact | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Delete `${{inputs.artifact}}` | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
res=$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{github.repository}}/actions/runs/${{github.run_id}}/artifacts?name="${{inputs.artifact}}") | ||
artifact_id=$(echo "$res" | jq -r 'if .total_count > 0 then .artifacts[0].id else 0 end') | ||
if [ "$artifact_id" == "0" ]; then | ||
echo "No artifact to remove was found." | ||
else | ||
echo "Found the artifact ID $artifact_id for the ${{inputs.artifact}}." | ||
gh api \ | ||
--method DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{github.repository}}/actions/artifacts/$artifact_id | ||
echo "The artifact with the ID $artifact_id has been removed." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.