-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (101 loc) · 3.15 KB
/
life-recent-update.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Life recent auto update
on:
push:
branches:
- master
paths:
- "life/**"
- "!life/.vitepress/**"
- "!life/*"
- ".github/workflows/life-recent-update.yml"
- "script/requirements.txt"
# paths-ignore:
# - "life/.vitepress/**"
pull_request:
types: [opened, synchronize]
branches:
- master
paths:
- "life/**"
- "!life/.vitepress/**"
- "!life/*"
- ".github/workflows/life-recent-update.yml"
- "script/requirements.txt"
schedule:
# This is run at UTC 16:00 p.m., aka UTC+8 0:00 a.m.
- cron: "0 16 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
py-life-recent:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./script
steps:
- name: Checkout repository content
uses: actions/checkout@v4
# https://github.com/actions/checkout?tab=readme-ov-file#fetch-all-history-for-all-tags-and-branches
# Fetch all history for all tags and branches
# for py script
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Execute Python script
run: |
python latest.py 1
- 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 "docs: life latest" -a
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: test output
env:
AUGAGU: ${{steps.commit.outputs.has_changes}}
run: |
echo "=========="
echo "$GITHUB_OUTPUT"
echo "=========="
echo "${{steps.commit.outputs.has_changes}}"
echo "=========="
echo "$AUGAGU"
- name: Push changes
if: steps.commit.outputs.has_changes == 'true' && github.event_name != 'pull_request'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.DEPLOY_GH }}
branch: ${{ github.head_ref }}
# - name: Create Pull Request
# if: ${{ steps.commit.outputs.has_changes == 'true' }}
# uses: peter-evans/create-pull-request@v6
# with:
# token: ${{ secrets.DEPLOY_GH }}
# title: "docs: life latest"
# commit-message: "docs: life latest"
# committer: GitHub <[email protected]>
# author: GitHub <[email protected]>
# branch: create-pull-request/patch-life-recent-update
# base: master
# labels: |
# report
# automated pr
# assignees: DrAugus
# # Review cannot be requested from pull request author.
# # reviewers: DrAugus