Skip to content

Commit 2fd9804

Browse files
committed
Update workflows
1 parent a95cce8 commit 2fd9804

File tree

2 files changed

+30
-44
lines changed

2 files changed

+30
-44
lines changed

.github/workflows/generate.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
on:
2-
push:
3-
branches:
4-
- master
2+
schedule:
3+
- cron: "51 5 * * 1"
54
workflow_dispatch:
65

76
name: Generate themes site
@@ -12,41 +11,56 @@ jobs:
1211
runs-on: ubuntu-latest
1312
steps:
1413
- name: Checkout latest
15-
uses: actions/checkout@master
14+
uses: actions/checkout@v6.0.1
1615
with:
1716
submodules: "recursive"
17+
- name: Update themes to latest
18+
run: git submodule update --remote
19+
- name: Commit updated themes
20+
id: themes
21+
run: |
22+
if [[ `git status --short` ]]; then
23+
git config --global user.email "action@github.com"
24+
git config --global user.name "GitHub Action"
25+
git commit -am "Update all themes"
26+
git push
27+
echo "has_changes=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "has_changes=false" >> $GITHUB_OUTPUT
30+
fi
1831
- name: Setup Python 3
19-
uses: actions/setup-python@v2
32+
if: steps.themes.outputs.has_changes == 'true'
33+
uses: actions/setup-python@v6.1.0
2034
with:
2135
python-version: '3.8'
2236
- name: Install Python requirements
37+
if: steps.themes.outputs.has_changes == 'true'
2338
run: pip install -r requirements.txt
2439
- name: Run the generator script
40+
if: steps.themes.outputs.has_changes == 'true'
2541
run: python generate_docs.py site
26-
- uses: actions/upload-artifact@v4
42+
- uses: actions/upload-artifact@v6
43+
if: steps.themes.outputs.has_changes == 'true'
2744
with:
2845
name: themes-directory
2946
path: site/*
3047
- name: Checkout zola repo
31-
uses: actions/checkout@v2
48+
if: steps.themes.outputs.has_changes == 'true'
49+
uses: actions/checkout@v6.0.1
3250
with:
3351
repository: 'getzola/zola'
3452
path: 'zola'
3553
token: ${{ secrets.TOKEN }}
3654
- name: Copy updated themes site
55+
if: steps.themes.outputs.has_changes == 'true'
3756
run: |
3857
cp -r site/* zola/docs/content/themes/
39-
- name: Commit files
40-
run: |
41-
cd zola
42-
git config --local user.email "action@github.com"
43-
git config --local user.name "GitHub Action"
44-
git add docs/content/themes
45-
git commit -m "Update themes gallery" -a
4658
- name: Create pull request
47-
uses: peter-evans/create-pull-request@v3
59+
if: steps.themes.outputs.has_changes == 'true'
60+
uses: peter-evans/create-pull-request@v8
4861
with:
4962
title: 'Update themes gallery'
5063
path: 'zola'
5164
token: ${{ secrets.TOKEN }}
52-
branch-suffix: 'timestamp'
65+
commit-message: 'Update themes gallery'
66+
labels: skip-changelog

.github/workflows/update-all-themes.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)