Skip to content

Commit 2c11b81

Browse files
Bordalantiga
authored andcommitted
ci/docs: create PR only if needed (#18790)
(cherry picked from commit a2377e9)
1 parent 1b4faf8 commit 2c11b81

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/docs-tutorials.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
- name: initial state
2828
run: |
2929
git submodule status
30+
short_sha=$(git submodule status | grep -A 1 _notebooks | cut -c1-8)
31+
echo "SHA_ACTUAL=$short_sha" >> $GITHUB_ENV
3032
# Skip smudge - We'll download binary files later in a faster batch
3133
git lfs install --skip-smudge
3234
- name: update submodules
@@ -41,10 +43,10 @@ jobs:
4143
git status
4244
4345
short_sha=$(git submodule status | grep -A 1 _notebooks | cut -c1-8)
44-
echo "SHA_SHORT=$short_sha" >> $GITHUB_ENV
46+
echo "SHA_LATEST=$short_sha" >> $GITHUB_ENV
4547
4648
- name: Create Pull Request
47-
if: github.event_name != 'pull_request'
49+
if: ${{ github.event_name != 'pull_request' && env.SHA_ACTUAL != env.SHA_LATEST }}
4850
uses: peter-evans/create-pull-request@v5
4951
with:
5052
title: "docs: update ref to latest tutorials"
@@ -59,8 +61,9 @@ jobs:
5961
# the PR's body/content
6062
body: >
6163
**This is automated update with the latest lighting tutorials!**
64+
6265
The target commit in the [publication](https://github.com/Lightning-AI/tutorials/tree/publication)
63-
branch is [${{ env.SHA_SHORT }}](https://github.com/Lightning-AI/tutorials/commit/${{ env.SHA_SHORT }}).
66+
branch is [${{ env.SHA_LATEST }}](https://github.com/Lightning-AI/tutorials/commit/${{ env.SHA_LATEST }}).
6467
6568
Before proceeding further double check that the PR include only submodule's head update.
6669
Eventually some additional adjustments in lightning docs may be needed.

0 commit comments

Comments
 (0)