Detects if there are changes; if there are, commits them to a new branch.
The actual creation of the changes to start out with is beyond the scope of this action.
It's intended to be used by the license-copyright-add workflow in repositories derived from the standard RSE templates.
Example:
- name: Detect and push changes
uses: UoMResearchIT/actions/git-push-changes-to-branch@v1.2.3
id: push
with:
working-directory: repo
branch-prefix: add-license-headers-to
commit-message: Add License and Copyright Headers
- name: Commit comment if had to create new branch
if: steps.push.outputs.changed
uses: peter-evans/commit-comment@v3
with:
body: >
Copyright updates at
${{ github.server_url }}/${{ github.repository }}/compare/${{ github.head_ref }}...${{ steps.push.outputs.branch }}?expand=1,
please review and merge.Note
This action is designed to run on Linux runners. It is not supported on other platforms.
Note
This action may interact with other actions that set up the git global configuration.
-
branch-prefixPrefix of the branch name to use. If not specified, uses "
autocommit", so you probably should specify this. Optional/Recommended. -
commit-messageThe commit message to use. Defaults to "
Changes generated by workflow", so you probably should specify this. Optional/Recommended. -
commit-user-nameThe name of the user to ascribe the commit to. Defaults to "
GitHub Actions". Optional. -
commit-user-emailThe email address of the user to ascribe the commit to. Defaults to "
no-reply@github.com". Optional. -
tokenAccess token used for writing the new branch to the repository. Optional.
-
working-directoryWhich working directory to look at. Defaults to the base directory of the workflow run. Optional.
-
branchThe name of the branch that may have been created. NB: The branch is only created if the
changedoutput istrue. -
changedWhether there were any changes committed. (
trueif yes,falseif no.)
Required permission:
contents: write