-
Notifications
You must be signed in to change notification settings - Fork 40
61 lines (52 loc) · 1.92 KB
/
pr-remove-test-branch.yml
File metadata and controls
61 lines (52 loc) · 1.92 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
55
56
57
58
59
60
61
name: PRs » Remove Pull Request Page
on:
pull_request_target:
types:
- closed
concurrency:
group: pull-request-page
cancel-in-progress: false
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
jobs:
delete-pr-directory:
runs-on: ubuntu-latest
steps:
- name: Prepare git
run: |
git config --global user.name "Admin Interface Deployment Bot"
git config --global user.email "cloud@opencast.org"
- name: Prepare GitHub SSH key from org level secret
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_TEST }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Clone test repository
run: |
git clone -b gh-pages "git@github.com:opencast/opencast-admin-interface-test.git" admin-interface-test
- name: Delete build if present
working-directory: admin-interface-test
run: |
if [ -d "${PR_NUMBER}" ]; then
rm -rf "${PR_NUMBER}"
echo "Directory ${PR_NUMBER} deleted successfully."
else
echo "Directory ${PR_NUMBER} does not exist. Skipping deletion."
fi
- name: Clean index.html
working-directory: admin-interface-test
run: |
echo '<html><body><ul>' > index.html
find . -maxdepth 2 -name '*_*' -type d \
| sort -r \
| sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html
echo '</ul></body></html>' >> index.html
- name: Commit new version
working-directory: admin-interface-test
run: |
git add .
# Commit and push, or just say true since the commit fails if nothing has changed
(git commit -m "Remove deployment ${PR_NUMBER} due to PR closure" && git push origin gh-pages --force) || true