File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ GitHub Actions to publish AUR package.
2828
2929** Optional** Commit message to use when creating the new commit.
3030
31+ ### ` allow_empty_commits `
32+
33+ ** Optional** Allow empty commits, i.e. commits with no change. The default value is ` true ` .
34+
3135### ` ssh_keyscan_types `
3236
3337** Optional** Comma-separated list of types to use when adding aur.archlinux.org to known hosts.
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ inputs:
2424 description : ' Commit message to use when creating the new commit'
2525 required : false
2626 default : ' Update PKGBUILD and .SRCINFO with GitHub Actions'
27+ allow_empty_commits :
28+ description : ' Allow empty commits, i.e. commits with no change.'
29+ required : false
30+ default : ' true'
2731 ssh_keyscan_types :
2832 description : ' Comma-separated list of types to use when adding aur.archlinux.org to known hosts'
2933 required : false
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ commit_username=$INPUT_COMMIT_USERNAME
88commit_email=$INPUT_COMMIT_EMAIL
99ssh_private_key=$INPUT_SSH_PRIVATE_KEY
1010commit_message=$INPUT_COMMIT_MESSAGE
11+ allow_empty_commits=$INPUT_ALLOW_EMPTY_COMMITS
1112ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES
1213
1314export HOME=/home/builder
@@ -49,6 +50,10 @@ echo '::endgroup::'
4950echo ' ::group::Publishing'
5051git remote add aur " ssh://aur@aur.archlinux.org/${pkgname} .git"
5152git add -fv PKGBUILD .SRCINFO
52- git commit --allow-empty -m " $commit_message "
53- git push -fv aur master
53+ case " $allow_empty_commits " in
54+ true) git commit --allow-empty -m " $commit_message " ;;
55+ false) git diff-index --quiet HEAD || git commit -m " $commit_message " ;; # use `git diff-index --quiet HEAD ||` to avoid error
56+ * ) echo ' The option "allow_empty_commits" should be either "true" or "false".' && false ;;
57+ esac
58+ git push --force-with-lease -v aur master
5459echo ' ::endgroup::'
You can’t perform that action at this time.
0 commit comments