forgejo-cI: clean-up previews based on SHA rather than PR metadata
This commit is contained in:
parent
a068a2788e
commit
708e863120
2 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue