forgejo-cI: clean-up previews based on SHA rather than PR metadata
Some checks failed
/ cleanup (pull_request) Failing after 24s
/ preview (pull_request) Successful in 40s

This commit is contained in:
IkiWiki 2024-08-25 22:11:02 -04:00
parent a068a2788e
commit eaea589ac3
Signed by untrusted user who does not match committer: forge
GPG key ID: D62A472A4AA7D541
2 changed files with 3 additions and 2 deletions

View file

@ -10,8 +10,7 @@ jobs:
steps:
- name: Environment setup
run: |
apk add git nodejs jq coreutils curl tree
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
apk add git nodejs jq coreutils curl tree gawk grep
- name: Public repo pull
uses: actions/checkout@v4
with:
@ -20,6 +19,7 @@ jobs:
ref: public
- name: Render website
run: |
echo "GITHUB_PR_NAME=$(grep -l ${{ github.sha }} previews/*/git_sha.txt | awk -F '/' '{print $2}')" >> $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

View file

@ -40,6 +40,7 @@ jobs:
git log -1 --pretty=%B > commit.txt
cd public
date > previews/$GITHUB_PR_NAME/generated.txt
echo ${{ github.sha }} > previews/$GITHUB_PR_NAME/git_sha.txt
# Note: the following account information will not work on GHES
git config user.name "forgejo-actions[bot]"
git config user.email "dev@ayakael.net"