diff --git a/.forgejo/workflows/cleanup.yaml b/.forgejo/workflows/cleanup.yaml index 808e4e7..69921a7 100644 --- a/.forgejo/workflows/cleanup.yaml +++ b/.forgejo/workflows/cleanup.yaml @@ -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,8 @@ jobs: 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 diff --git a/.forgejo/workflows/preview.yaml b/.forgejo/workflows/preview.yaml index 0891405..3ad603e 100644 --- a/.forgejo/workflows/preview.yaml +++ b/.forgejo/workflows/preview.yaml @@ -11,7 +11,7 @@ jobs: - name: Environment setup run: | apk add git ikiwiki po4a perl-yaml-tiny tree 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 + 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:]' | tr '/' '-')" >> $GITHUB_ENV - name: Repo pull uses: actions/checkout@v4 with: @@ -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"