forgejo-cI: clean-up previews based on SHA rather than PR metadata #11
2 changed files with 5 additions and 3 deletions
|
@ -10,8 +10,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Environment setup
|
- name: Environment setup
|
||||||
run: |
|
run: |
|
||||||
apk add git nodejs jq coreutils curl tree
|
apk add git nodejs jq coreutils curl tree gawk grep
|
||||||
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
|
- name: Public repo pull
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
@ -20,6 +19,8 @@ jobs:
|
||||||
ref: public
|
ref: public
|
||||||
- name: Render website
|
- name: Render website
|
||||||
run: |
|
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
|
rm -rf previews/$GITHUB_PR_NAME || true
|
||||||
cd previews
|
cd previews
|
||||||
tree -d -H '.' -L 1 --noreport --charset utf-8 -T "Versions" -o index.html
|
tree -d -H '.' -L 1 --noreport --charset utf-8 -T "Versions" -o index.html
|
||||||
|
|
|
@ -11,7 +11,7 @@ jobs:
|
||||||
- name: Environment setup
|
- name: Environment setup
|
||||||
run: |
|
run: |
|
||||||
apk add git ikiwiki po4a perl-yaml-tiny tree nodejs jq coreutils curl
|
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
|
- name: Repo pull
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
@ -40,6 +40,7 @@ jobs:
|
||||||
git log -1 --pretty=%B > commit.txt
|
git log -1 --pretty=%B > commit.txt
|
||||||
cd public
|
cd public
|
||||||
date > previews/$GITHUB_PR_NAME/generated.txt
|
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
|
# Note: the following account information will not work on GHES
|
||||||
git config user.name "forgejo-actions[bot]"
|
git config user.name "forgejo-actions[bot]"
|
||||||
git config user.email "dev@ayakael.net"
|
git config user.email "dev@ayakael.net"
|
||||||
|
|
Loading…
Reference in a new issue