-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (41 loc) · 1.26 KB
/
auto-hompage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Auto regenerate homepage
on:
push:
branches:
- master
paths:
- "**.md"
- ".github/workflows/auto-hompage.yml"
jobs:
# Auto regenerate homepage
regenerate:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/checkout@v4
# Other steps that change files in the repository
- name: Execute Python script
run: |
python homepage.py
- name: Commit files
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
if git diff --cached --quiet; then
echo "No changes to commit"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
git commit -m "feat: auto reg homepage" -a
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: ${{ steps.commit.outputs.has_changes == 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.DEPLOY_GH }}
branch: ${{ github.head_ref }}