Skip to content

Commit

Permalink
chore(actions): clean intermediate artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
rbioteau committed Dec 20, 2023
1 parent c826dcd commit 29c6d10
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,22 @@ jobs:
needs: deploy
runs-on: ubuntu-22.04
steps:

- run: |
# List workflow artifacts and retrieve their ids
artifacts=echo "$(gh api \
artifacts="$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$OWNER/$REPO/actions/runs/${{ github.run_id }}/artifacts \
--jq '[.artifacts[] | .id] | @csv')"
# Delete all workflow artifacts
artifactIds=( ${artifacts//,/ } )
echo 'ARTIFACTS='$artifacts >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
- run: |
artifactIds=( ${${{ env.ARTIFACTS }}//,/ } )
for artifactId in $artifactIds
do
gh api \
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,22 @@ jobs:
needs: deploy
runs-on: ubuntu-22.04
steps:

- run: |
# List workflow artifacts and retrieve their ids
artifacts=echo "$(gh api \
artifacts="$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$OWNER/$REPO/actions/runs/${{ github.run_id }}/artifacts \
--jq '[.artifacts[] | .id] | @csv')"
# Delete all workflow artifacts
artifactIds=( ${artifacts//,/ } )
echo 'ARTIFACTS='$artifacts >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
- run: |
artifactIds=( ${${{ env.ARTIFACTS }}//,/ } )
for artifactId in $artifactIds
do
gh api \
Expand Down

0 comments on commit 29c6d10

Please sign in to comment.