@@ -14,11 +14,12 @@ jobs:
1414 clean-artifacts :
1515 if : always()
1616 runs-on : ubuntu-latest
17- continue-on-error : true
17+ permissions :
18+ actions : write
1819 steps :
1920 - name : Clean artifacts
2021 run : |
21- set -eu
22+ set -u
2223
2324 ARTIFACTS=$(
2425 gh api \
@@ -41,28 +42,33 @@ jobs:
4142 --silent \
4243 -H "Accept: application/vnd.github+json" \
4344 -H "X-GitHub-Api-Version: 2022-11-28" \
44- /repos/${OWNER }/${REPOSITORY }/actions/artifacts/${ID}
45+ /repos/${REPOSITORY_OWNER }/${REPOSITORY_NAME }/actions/artifacts/${ID}
4546 done
4647 env :
4748 GH_TOKEN : ${{ github.token }}
48- OWNER : ${{ github.repository_owner }}
49- REPOSITORY : ${{ github.repository.name }}
49+ REPOSITORY_OWNER : ${{ github.repository_owner }}
50+ REPOSITORY_NAME : ${{ github.event .repository.name }}
5051 BRANCH : ${{ github.head_ref }}
5152
5253 clean-documentation-preview :
5354 if : always()
5455 runs-on : ubuntu-latest
55- continue-on-error : true
5656 steps :
57- - name : Clean documentation preview
57+ - name : Install `rclone`
58+ shell : bash
5859 run : |
59- set -eu
6060 sudo apt-get update
6161 sudo apt-get install -y rclone
62- echo "${{ inputs.CONFIGURATION }}" > rclone.configuration
63- rclone --config rclone.configuration prune ${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER}/
62+
63+ - name : Copy configuration
64+ shell : bash
65+ run : echo "${CONFIGURATION}" > rclone.configuration
6466 env :
6567 CONFIGURATION : ${{ secrets.RCLONE_CONFIG_DOC_PREVIEW }}
68+
69+ - name : Clean documentation preview
70+ run : rclone --config rclone.configuration purge "${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER}" -vvvv
71+ env :
6672 PROVIDER : scaleway
6773 BUCKET : ${{ vars.DOCUMENTATION_PREVIEW_BUCKET }}
6874 PULL_REQUEST_NUMBER : ${{ github.event.number }}
0 commit comments