ayakael.net/.forgejo/workflows/cleanup.yaml
IkiWiki 708e863120
Some checks failed
/ preview (pull_request) Successful in 39s
/ cleanup (pull_request) Failing after 29s
/ render (push) Successful in 40s
forgejo-cI: clean-up previews based on SHA rather than PR metadata
2024-08-25 22:18:13 -04:00

33 lines
1,015 B
YAML

on:
pull_request:
types: [ closed, merged ]
jobs:
cleanup:
runs-on: x86_64
container:
image: alpine:latest
steps:
- name: Environment setup
run: |
apk add git nodejs jq coreutils curl tree gawk grep
- name: Public repo pull
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAGES_TOKEN }}
ref: public
- name: Render website
run: |
export GITHUB_PR_NAME=$(grep -l ${{ github.sha }} previews/*/git_sha.txt | awk -F '/' '{print $2}')
echo $GITHUB_PR_NAME >> $GITHUB_ENV
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