-
Notifications
You must be signed in to change notification settings - Fork 86
54 lines (47 loc) · 1.91 KB
/
delete-preview.yaml
File metadata and controls
54 lines (47 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Delete preview from OVH Object Storage
on:
workflow_run:
workflows: ["Ask preview removal for a given PR"]
types:
- completed
permissions: {}
jobs:
remove:
permissions:
actions: read # for actions/download-artifact to download artifacts from other workflow runs
contents: read # for actions/checkout to fetch code
issues: write # for ./.github/actions/delete-preview (peter-evans/create-or-update-comment) to create or update comment
pull-requests: write # for ./.github/actions/delete-preview (peter-evans/create-or-update-comment) to create or update comment on pull requests
name: Delete preview from OVHcloud Object Storage
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: PR
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
- name: Get PR number
id: pr_number
run: |
PR_NUMBER=$(cat PR_NUMBER)
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
echo "::error::Invalid PR number: ${PR_NUMBER}"
exit 1
fi
echo "pr_number=${PR_NUMBER}" >> "$GITHUB_OUTPUT"
- name: Check-out the repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: |
.github/actions/
- name: Delete preview
uses: ./.github/actions/delete-preview
with:
pull_request_id: ${{ steps.pr_number.outputs.pr_number }}
os_tenant_id: ${{ secrets.PR_OS_TENANT_ID }}
os_tenant_name: ${{ secrets.PR_OS_TENANT_NAME }}
os_username: ${{ secrets.PR_OS_USERNAME }}
os_password: ${{ secrets.PR_OS_PASSWORD }}
github_token: ${{ secrets.GITHUB_TOKEN }}
message: |
_Pull request was merged, preview was removed._