2024-08-26 01:56:32 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [ closed, merged ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
cleanup:
|
|
|
|
runs-on: x86_64
|
|
|
|
container:
|
|
|
|
image: alpine:latest
|
|
|
|
steps:
|
|
|
|
- name: Environment setup
|
|
|
|
run: |
|
2024-08-26 02:11:02 +00:00
|
|
|
apk add git nodejs jq coreutils curl tree gawk grep
|
2024-08-26 01:56:32 +00:00
|
|
|
- name: Public repo pull
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
token: ${{ secrets.PAGES_TOKEN }}
|
|
|
|
ref: public
|
|
|
|
- name: Render website
|
|
|
|
run: |
|
2024-08-26 02:11:02 +00:00
|
|
|
export GITHUB_PR_NAME=$(grep -l ${{ github.sha }} previews/*/git_sha.txt | awk -F '/' '{print $2}')
|
|
|
|
echo $GITHUB_PR_NAME >> $GITHUB_ENV
|
2024-08-26 01:56:32 +00:00
|
|
|
rm -rf previews/$GITHUB_PR_NAME || true
|
|
|
|
cd previews
|
|
|
|
tree -d -H '.' -L 1 --noreport --charset utf-8 -T "Versions" -o index.html
|
|
|
|
- name: Website upload
|
|
|
|
run: |
|
|
|
|
git config user.name "forgejo-actions[bot]"
|
|
|
|
git config user.email "dev@ayakael.net"
|
|
|
|
git add .
|
|
|
|
git commit -m "Clean-up $GITHUB_PR_NAME"
|
|
|
|
git push
|