Skip to content

Commit

Permalink
Prevent fail on no changes in commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aormsby committed Nov 26, 2021
1 parent cc5e0a1 commit 74592c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ An action for building Hugo websites. Build your site from a source branch and d

This action supports deploying to the same repository or pushing build data to a submodule. It's great for automating Hugo site builds and maintaining a separate release branch.

**v2.1 Fix:** Build process no longer throws an error when there are no changes to commit. Safe exit instead. This was mainly done to prevent the whole workflow from failing.

## Updates in v2

[See wiki for more info on these changes.](https://github.com/aormsby/hugo-deploy-to-pages/wiki))
Expand Down Expand Up @@ -98,7 +100,7 @@ jobs:
# <<fetch-depth: '0' currently required until shallow clone problems are solved>>

- name: Build site and push to release branch
uses: aormsby/hugo-deploy-to-pages@v2
uses: aormsby/hugo-deploy-to-pages@v2.1
id: build_step # <<for outputs>>
with:
source_branch: 'main'
Expand Down
3 changes: 0 additions & 3 deletions hugo-deploy.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#c26fb099",
"titleBar.inactiveForeground": "#15202b99",
"editorGroup.border": "#d193c4",
"panel.border": "#d193c4",
"sash.hoverBorder": "#d193c4",
"sideBar.border": "#d193c4",
"statusBarItem.remoteBackground": "#c26fb0",
"statusBarItem.remoteForeground": "#15202b"
},
Expand Down
5 changes: 3 additions & 2 deletions run/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ commit_with_message() {
COMMAND_STATUS=$?

if [ "${COMMAND_STATUS}" != 0 ]; then
# exit on git commit fail
write_out "${COMMAND_STATUS}" "Git commit step failed in '${1}' directory. Check output and try again."
# safe exit on git commit fail, but with warning
write_out "y" "Git commit step failed in '${1}' directory. It's possible there were no changes to commit, so a safe exit is assumed."
write_out 0 'No changes since last build. Exiting gracefully.'
fi
}

Expand Down

0 comments on commit 74592c3

Please sign in to comment.