Skip to content

A GitHub Action for automatically committing changes

License

Notifications You must be signed in to change notification settings

quizlet/commit-changes-action

 
 

Repository files navigation

Commit Changes Action

Check, Build, and Run Contributor Covenant

This is an action that uses the Github Git Database API to commit changes to a branch. This allows for easier committing against protected branches, and avoids a lot of potential edge cases that can occur when using git directly.

Inputs

Name Default/Required Description
message None, required Message for the commit
glob-patterns None, required List of minimatch glob patterns. Matching files with changes will be committed. See the examples for how to specify multiple patterns.
token Default Github Actions Token Github token to authenticate as
branch Default branch for the repo Branch to commit the changes to
append-run-info true Whether to append information about the workflow to the commit
retries 10 Number of times to retry the commit (which may fail due to non-fastfoward upates)

Outputs

Name Description
sha SHA of the resulting commit. Will be empty string if there were no changes to commit

Example usage

uses: quizlet/commit-changes@[ref]
with:
  message: Automated commit
  glob-patterns: README.md

Setting token

Useful when:

  • You want to commit as a different actor than the default Github Actions token
  • You want to use an admin user to commit to a protected branch
uses: quizlet/commit-changes@[ref]
with:
  token: ${{ secret.ADMIN_TOKEN }}
  message: Automated commit
  glob-patterns: README.md

Multiple glob patterns

Comma separated

uses: quizlet/commit-changes@[ref]
with:
  message: Automated commit
  glob-patterns: README.md, *.json

Newline separated

uses: quizlet/commit-changes@[ref]
with:
  message: Automated commit
  glob-patterns: |
    README.md
    # Comments are allowed
    *.json

Resources

Contributing

Feel free to check out our Contributor's Guide.

License

The code and documentation in this project are released under the MIT License.