Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Push Changes to Git Branch

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.

Inputs

  • branch-prefix

    Prefix of the branch name to use. If not specified, uses "autocommit", so you probably should specify this. Optional/Recommended.

  • commit-message

    The commit message to use. Defaults to "Changes generated by workflow", so you probably should specify this. Optional/Recommended.

  • commit-user-name

    The name of the user to ascribe the commit to. Defaults to "GitHub Actions". Optional.

  • commit-user-email

    The email address of the user to ascribe the commit to. Defaults to "no-reply@github.com". Optional.

  • token

    Access token used for writing the new branch to the repository. Optional.

  • working-directory

    Which working directory to look at. Defaults to the base directory of the workflow run. Optional.

Outputs

  • branch

    The name of the branch that may have been created. NB: The branch is only created if the changed output is true.

  • changed

    Whether there were any changes committed. (true if yes, false if no.)

Permissions

Required permission:

      contents: write