11name : cleanup PR
22
3- on :
4- pull_request_target :
5- types : [closed]
3+ # on:
4+ # pull_request_target:
5+ # types: [closed]
6+
7+ on : [pull_request_target]
68
79permissions : {}
810
@@ -14,11 +16,11 @@ jobs:
1416 clean-artifacts :
1517 if : always()
1618 runs-on : ubuntu-latest
17- continue-on-error : true
19+ permissions : write-all
1820 steps :
1921 - name : Clean artifacts
2022 run : |
21- set -eu
23+ set -u
2224
2325 ARTIFACTS=$(
2426 gh api \
@@ -41,28 +43,31 @@ jobs:
4143 --silent \
4244 -H "Accept: application/vnd.github+json" \
4345 -H "X-GitHub-Api-Version: 2022-11-28" \
44- /repos/${OWNER }/${REPOSITORY }/actions/artifacts/${ID}
46+ /repos/${REPOSITORY_OWNER }/${REPOSITORY_NAME }/actions/artifacts/${ID}
4547 done
4648 env :
4749 GH_TOKEN : ${{ github.token }}
48- OWNER : ${{ github.repository_owner }}
49- REPOSITORY : ${{ github.repository.name }}
50+ REPOSITORY_OWNER : ${{ github.repository_owner }}
51+ REPOSITORY_NAME : ${{ github.event .repository.name }}
5052 BRANCH : ${{ github.head_ref }}
5153
5254 clean-documentation-preview :
5355 if : always()
5456 runs-on : ubuntu-latest
55- continue-on-error : true
5657 steps :
57- - name : Clean documentation preview
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+ - shell : bash
64+ run : echo "${CONFIGURATION}" > rclone.configuration
6465 env :
6566 CONFIGURATION : ${{ secrets.RCLONE_CONFIG_DOC_PREVIEW }}
67+
68+ - name : Clean documentation preview
69+ run : rclone --config rclone.configuration purge ${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER} -vvvv
70+ env :
6671 PROVIDER : scaleway
6772 BUCKET : ${{ vars.DOCUMENTATION_PREVIEW_BUCKET }}
6873 PULL_REQUEST_NUMBER : ${{ github.event.number }}
0 commit comments