Skip to content

Commit 70843f6

Browse files
committed
Update workflow to only generate docs if necessary
1 parent 12c94cb commit 70843f6

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

.github/workflows/update-generated-docs.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,37 @@ jobs:
1212
environment: Docs generation
1313
permissions:
1414
contents: write
15+
env:
16+
CURRENT_DOCS_VERSION: release/0.20.0
1517
steps:
1618
- uses: actions/checkout@v4
1719
with:
1820
ref: main
1921

2022
- run: |
21-
sudo apt-get update
22-
sudo apt-get install -y libdbus-1-dev pkg-config
23+
git clone https://github.com/gitbutlerapp/gitbutler ../gitbutler
2324
24-
- run: git clone --depth=1 https://github.com/gitbutlerapp/gitbutler ../gitbutler
25-
- run: ./scripts/update-manpages.sh
25+
- id: versions
26+
run: |
27+
LATEST_RELEASE=$(git -C ../gitbutler tag --sort=-version:refname | grep '^release/' | head -n 1)
28+
29+
echo "latest_release=$LATEST_RELEASE" >> "$GITHUB_OUTPUT"
30+
31+
if [ "$LATEST_RELEASE" != "$CURRENT_DOCS_VERSION" ]; then
32+
echo "should_update=true" >> "$GITHUB_OUTPUT"
33+
else
34+
echo "should_update=false" >> "$GITHUB_OUTPUT"
35+
fi
36+
37+
- if: steps.versions.outputs.should_update == 'true'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y libdbus-1-dev libglib2.0-dev pkg-config
41+
42+
./scripts/update-manpages.sh
43+
44+
sed -i "s|CURRENT_DOCS_VERSION: .*|CURRENT_DOCS_VERSION: ${{ steps.versions.outputs.latest_release }}|" .github/workflows/update-generated-docs.yml
2645
27-
- run: |
2846
git config user.name "github-actions[bot]"
2947
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3048
@@ -36,7 +54,8 @@ jobs:
3654
3755
echo "branch=$branch" >> "$GITHUB_ENV"
3856
39-
- run: |
57+
- if: steps.versions.outputs.should_update == 'true'
58+
run: |
4059
gh pr create \
4160
--title "Update generated CLI documentation" \
4261
--body "Created by CI" \

0 commit comments

Comments
 (0)