-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: rename workflow * chore: rename push.yml to release.yml * chore: rename workflow * chore: rename workflow * ci: add garbage collection * fix: syntax incorrect * fix: syntax error * fix: syntax error * fix: syntax error * ci: gc every month first day
- Loading branch information
1 parent
c10a0a1
commit e667f6c
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: garbage collection | ||
on: | ||
# pull_request: | ||
# types: [opened, reopened, synchronize] | ||
# https://crontab.guru/#0_1_1_*_* | ||
schedule: | ||
- cron: "0 1 1 * *" | ||
permissions: | ||
actions: write | ||
contents: write | ||
id-token: write | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
jobs: | ||
garbage_collection: | ||
name: Remove old build result on GH page | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
|
||
- id: remove | ||
run: | | ||
echo "OLD_FOLDERS=$(git ls-tree -r --name-only gh-pages@{30.days.ago} | cut -d/ -f1 | uniq)" | ||
if [ -n "$OLD_FOLDERS" ]; then | ||
rm -r $OLD_FOLDERS | ||
git add . | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git commit -m "docs: 🤖 garbage collection old build results" | ||
echo "result=1" >> $GITHUB_OUTPUT | ||
else | ||
echo "result=''" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
if: ${{ steps.remove.outputs.OLD_FOLDERS != '' }} | ||
with: | ||
github_token: ${{ env.GITHUB_TOKEN }} | ||
branch: gh-pages |
2 changes: 1 addition & 1 deletion
2
.github/workflows/main.yml → .github/workflows/pull_request.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: main | ||
name: pull request | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, closed] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: "Release" | ||
name: "release" | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Schedule testing | ||
name: schedule testing | ||
on: | ||
schedule: | ||
- cron: "0 2 * * 3,6" | ||
|