Skip to content

Commit 11f2672

Browse files
committed
Check for content change before publishing
Adds a check to make sure there are acutally changes to be commited and pushed. This is needed to address a situation where the publish docs workflow is triggered, but there are no changes to the documentation content. Changes `cancel-in-progress` to false, to avoid missing publishing documentation, when another publish workflow is triggerd by a commit that might not have any changes to the documentation to add. Signed-off-by: Winford <winford@object.stream>
1 parent 69ee6a6 commit 11f2672

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/publish-docs.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929

3030
concurrency:
3131
group: ${{ github.workflow }}-${{ github.ref_name }}
32-
cancel-in-progress: true
32+
cancel-in-progress: false
3333

3434
env:
3535
AVM_DOCS_NAME: ${{ github.ref_name }}
@@ -119,17 +119,20 @@ jobs:
119119
git checkout Production
120120
git config --local user.email "atomvm-doc-bot@users.noreply.github.com"
121121
git config --local user.name "AtomVM Doc Bot"
122-
git add .
123-
git commit -m "Update Documentation"
122+
if [ -n "$(git status --porcelain=v1)" ]; then
123+
git add .
124+
git commit -m "Update Documentation"
125+
fi
124126
- name: Push changes
125127
if: github.repository == 'atomvm/AtomVM'
126128
working-directory: /home/runner/work/AtomVM/AtomVM/www
127129
run: |
128-
eval `ssh-agent -t 60 -s`
129-
echo "${{ secrets.PUBLISH_ACTION_KEY }}" | ssh-add -
130-
mkdir -p ~/.ssh/
131-
ssh-keyscan github.com >> ~/.ssh/known_hosts
132-
git remote add push_dest "git@github.com:atomvm/atomvm_www.git"
133-
git fetch push_dest
134-
git push --set-upstream push_dest Production
135-
130+
if [ -n "$(git status --porcelain=v1)" ]; then
131+
eval `ssh-agent -t 60 -s`
132+
echo "${{ secrets.PUBLISH_ACTION_KEY }}" | ssh-add -
133+
mkdir -p ~/.ssh/
134+
ssh-keyscan github.com >> ~/.ssh/known_hosts
135+
git remote add push_dest "git@github.com:atomvm/atomvm_www.git"
136+
git fetch push_dest
137+
git push --set-upstream push_dest Production
138+
fi

0 commit comments

Comments
 (0)