Skip to content

Commit 4e05c39

Browse files
committed
Fix
1 parent 39a51bb commit 4e05c39

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

.github/workflows/pr-cleanup.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: 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

79
permissions: {}
810

@@ -14,11 +16,13 @@ jobs:
1416
clean-artifacts:
1517
if: always()
1618
runs-on: ubuntu-latest
17-
continue-on-error: true
19+
permissions:
20+
actions: write
21+
1822
steps:
1923
- name: Clean artifacts
2024
run: |
21-
set -eu
25+
set -u
2226
2327
ARTIFACTS=$(
2428
gh api \
@@ -41,28 +45,33 @@ jobs:
4145
--silent \
4246
-H "Accept: application/vnd.github+json" \
4347
-H "X-GitHub-Api-Version: 2022-11-28" \
44-
/repos/${OWNER}/${REPOSITORY}/actions/artifacts/${ID}
48+
/repos/${REPOSITORY_OWNER}/${REPOSITORY_NAME}/actions/artifacts/${ID}
4549
done
4650
env:
4751
GH_TOKEN: ${{ github.token }}
48-
OWNER: ${{ github.repository_owner }}
49-
REPOSITORY: ${{ github.repository.name }}
52+
REPOSITORY_OWNER: ${{ github.repository_owner }}
53+
REPOSITORY_NAME: ${{ github.event.repository.name }}
5054
BRANCH: ${{ github.head_ref }}
5155

5256
clean-documentation-preview:
5357
if: always()
5458
runs-on: ubuntu-latest
55-
continue-on-error: true
5659
steps:
57-
- name: Clean documentation preview
60+
- name: Install `rclone`
61+
shell: bash
5862
run: |
59-
set -eu
6063
sudo apt-get update
6164
sudo apt-get install -y rclone
62-
echo "${{ inputs.CONFIGURATION }}" > rclone.configuration
63-
rclone --config rclone.configuration prune ${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER}/
65+
66+
- name: Copy configuration
67+
shell: bash
68+
run: echo "${CONFIGURATION}" > rclone.configuration
6469
env:
6570
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOC_PREVIEW }}
71+
72+
- name: Clean documentation preview
73+
run: rclone --config rclone.configuration purge "${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER}" -vvvv
74+
env:
6675
PROVIDER: scaleway
6776
BUCKET: ${{ vars.DOCUMENTATION_PREVIEW_BUCKET }}
68-
PULL_REQUEST_NUMBER: ${{ github.event.number }}
77+
PULL_REQUEST_NUMBER: 1027 # ${{ github.event.number }}

0 commit comments

Comments
 (0)