diff --git a/.forgejo/workflows/preview.yaml b/.forgejo/workflows/preview.yaml index 1f619bd..9d701a8 100644 --- a/.forgejo/workflows/preview.yaml +++ b/.forgejo/workflows/preview.yaml @@ -10,7 +10,8 @@ jobs: steps: - name: Environment setup run: | - apk add git ikiwiki po4a perl-yaml-tiny tree nodejs + apk add git ikiwiki po4a perl-yaml-tiny tree nodejs jq coreutils + echo "GITHUB_PR_NAME=$(curl -s https://ayakael.net/api/v1/repos/forge/ayakael.net/pulls/${{ github.ref_name }} | jq .title | tr ' ' '-' | tr -d ':')" >> $GITHUB_ENV - name: Repo pull uses: actions/checkout@v4 with: @@ -25,9 +26,9 @@ jobs: token: ${{ secrets.PAGES_TOKEN }} - name: Render website run: | - rm -rf public/previews/$CURRENT_CONTENT_PATH || true - mkdir -p public/previews/${{ github.ref_name }} - sed -i "s|destdir.*|destdir: ./public/previews/${{ github.ref_name }}|" ikiwiki.setup + rm -rf public/previews/$GITHUB_PR_NAME || true + mkdir -p public/previews/$GITHUB_PR_NAME + sed -i "s|destdir.*|destdir: ./public/previews/$GITHUB_PR_NAME|" ikiwiki.setup ikiwiki --setup ikiwiki.setup cd public/previews tree -d -H '.' -L 1 --noreport --charset utf-8 -T "Versions" -o index.html @@ -38,7 +39,7 @@ jobs: cp .forgejo/workflows/deploy.yaml public/.forgejo/workflows/. git log -1 --pretty=%B > commit.txt cd public - date > previews/${{ github.ref_name}}/generated.txt + date > previews/$GITHUB_PR_NAME/generated.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"