https://github.com/coderrob/commit-and-push
GitHub Action to commit changes and push to a remote
https://github.com/coderrob/commit-and-push
action github-action github-api gitops
Last synced: about 1 month ago
JSON representation
GitHub Action to commit changes and push to a remote
- Host: GitHub
- URL: https://github.com/coderrob/commit-and-push
- Owner: Coderrob
- License: apache-2.0
- Created: 2025-02-13T22:15:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-24T15:02:29.000Z (8 months ago)
- Last Synced: 2025-09-24T16:32:06.526Z (8 months ago)
- Topics: action, github-action, github-api, gitops
- Language: TypeScript
- Homepage:
- Size: 411 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Commit and Push Changes
[](https://github.com/Coderrob/commit-and-push/actions/workflows/ci.yml)
[](https://github.com/Coderrob/commit-and-push/actions/workflows/check-dist.yml)
[](https://github.com/Coderrob/commit-and-push/raw/main/badges/coverage.svg)
[](LICENSE)
[](https://nodejs.org/)
This action automates committing and pushing code changes to a GitHub
repository. It ensures updates are regularly applied without manual intervention
while following security best practices.
## Branding
| Attribute | Value |
| --------- | ---------- |
| Color | blue |
| Icon | git-commit |
## Inputs
| Name | Description | Default | Required | Deprecation |
| ------------------ | ----------------------------------------------------------- | ----------------------------------------------- | -------- | ----------- |
| github-hostname | GitHub hostname to support GitHub Enterprise installations. | github.com | ❌ No | - |
| github-token | GitHub token used for authentication | ${{ github.token }} | ✅ Yes | - |
| repository | GitHub repository in the format owner/repository | ${{ github.repository }} | ❌ No | - |
| remote-ref | Remote repository reference | origin | ❌ No | - |
| fetch-latest | Whether to fetch latest before committing changes | false | ❌ No | - |
| branch | Name of the branch to push the code into | ${{ github.ref_name }} | ❌ No | - |
| create-branch | Create branch if it does not exist | false | ❌ No | - |
| directory-path | Path to the directory containing files to commit and push | . | ❌ No | - |
| author-name | Name of the commit author | GitHub Actions | ❌ No | - |
| author-email | Email of the commit author | | ❌ No | - |
| sign-commit | Whether to sign commits using GPG (true/false) | false | ❌ No | - |
| commit-message | Commit message for the changes | Automated commit-and-push by GitHub Actions | ❌ No | - |
| force-push | Whether to force push (true/false) | false | ❌ No | - |
| open-pull-request | Whether to open pull request (true/false) | false | ❌ No | - |
| pull-request-title | Title of the pull request when open-pull-request is true | Automated Pull Request | ❌ No | - |
| pull-request-body | Body of the pull request when open-pull-request is true. | Automated pull request created by {author-name} | ❌ No | - |
## Outputs
| Name | Description | Value |
| ------------------- | -------------------------------------------------------------------------------- | ----- |
| commit-hash | The hash of the latest commit | |
| pull-request-number | The number of the created pull request (only set when open-pull-request is true) | |
| pull-request-url | The URL of the created pull request (only set when open-pull-request is true) | |
## Environment Variables
This action does not require any environment variables.
## Dependencies
This section provides a graph of dependencies relevant to this action.
dependencies:
- GitHub Actions Runner
- Specific environment variables
- Required files and configurations
## Runs
**Execution Type:** node20
This action uses a Node.js runtime configuration.
## Example Usage
jobs:
example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Commit and Push Changes
uses: ./
with:
github-token: ${{ github.token }}
repository: ${{ github.repository }}
branch: main
directory-path: .
author-name: GitHub Actions
author-email: github-actions@noreply.github.com
commit-message: Automated commit-and-push by GitHub Actions
## Acknowledgments
This project leverages Markdown generation techniques from
[coderrob.com](https://coderrob.com), developed by **Robert Lindley**.