forgejo-ci: clean-up workflow
This commit is contained in:
parent
5572c5bbf5
commit
ee7358764e
2 changed files with 34 additions and 1 deletions
33
.forgejo/workflows/cleanup.yaml
Normal file
33
.forgejo/workflows/cleanup.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
echo "GITHUB_PR_NAME=$(curl -Ls ${{ github.server_url }}/api/v1/repos/${{ github.repository }}/pulls/${{ github.ref_name }} | jq .title | tr ' ' '-' | tr -d ':' | tr -d '"' | tr '[:upper:]' '[:lower:]' )" >> $GITHUB_ENV
|
||||
- name: Public repo pull
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: public
|
||||
path: public
|
||||
token: ${{ secrets.PAGES_TOKEN }}
|
||||
- name: Render website
|
||||
run: |
|
||||
rm -rf previews/$GITHUB_PR_NAME || true
|
||||
cd public/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
|
|
@ -3,7 +3,7 @@ on:
|
|||
types: [ assigned, opened, synchronize, reopened ]
|
||||
|
||||
jobs:
|
||||
render:
|
||||
preview:
|
||||
runs-on: x86_64
|
||||
container:
|
||||
image: alpine:latest
|
||||
|
|
Loading…
Reference in a new issue