forgejo-ci: generate GITHUB_PR_NAME with curl API request
All checks were successful
/ render (pull_request) Successful in 37s
All checks were successful
/ render (pull_request) Successful in 37s
This commit is contained in:
parent
8df05997aa
commit
f50a5aa753
1 changed files with 6 additions and 5 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue