-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (54 loc) · 2.03 KB
/
daily_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
name: Daily update
on:
schedule:
- cron: '2 8 * * *' # 8:02 UTC
workflow_dispatch:
permissions: {} # Using PAT
concurrency:
group: "daily_update"
cancel-in-progress: false
jobs:
update-images:
name: Update images
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
fetch-depth: 2
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install Python's requirements
working-directory: src
run: pip install -r requirements.txt
- name: Update archive
working-directory: src
run: python update.py
env:
CLOUDFLARE_ACCOUNT_ID: '${{ secrets.CLOUDFLARE_ACCOUNT_ID }}'
CLOUDFLARE_AWS_ACCESS_KEY_ID: '${{ secrets.CLOUDFLARE_AWS_ACCESS_KEY_ID }}'
CLOUDFLARE_AWS_SECRET_ACCESS_KEY: '${{ secrets.CLOUDFLARE_AWS_SECRET_ACCESS_KEY }}'
- name: Get previous commit author
id: previous_commit
run: echo "PREVIOUS_COMMIT_AUHOUR=$(git log -1 --pretty=%an)" >> "$GITHUB_OUTPUT"
- name: Commit and push changes (amend previous update)
if: ${{ steps.previous_commit.outputs.PREVIOUS_COMMIT_AUHOUR == 'GitHub Actions' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Archive update
commit_user_name: GitHub Actions
commit_author: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
commit_options: --amend --no-edit
push_options: --force
skip_fetch: true
- name: Commit and push changes
if: ${{ steps.previous_commit.outputs.PREVIOUS_COMMIT_AUHOUR != 'GitHub Actions' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Archive update
commit_user_name: GitHub Actions
commit_author: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>