Github action which lets you to commit and push a file to a repository
Repo maxgfr/github-commit-push-file, read from GitHub 13 h ago. maxgfr has not joined Take My Repo.
maxgfr/github-commit-push-file is a public repo on GitHub by maxgfr. Github action which lets you to commit and push a file to a repository. It declares the MIT license on GitHub. It is written mainly in TypeScript, has 3 stars and last changed on 2026-11-04. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-23.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
maxgfr/github-commit-push-file is a GitHub Action which lets you commit and push files to a repository with advanced options like commit signing, custom author, selective file staging, PR creation, and more.
*.env)pathspec_from_file){{date}}, {{sha}}, {{branch}}, etc.)name: commit-and-push
on:
push:
branches: [main]
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Create a file
run: echo "Hello World" >> hello.txt
- name: Commit and push the file
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: add hello.txt'
Useful for scheduled workflows where you only want to commit if there are actual changes:
- name: Commit and push (if changes)
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update data'
files: 'data/output.json'
skip_if_no_changes: 'true'
Use template variables in commit messages, body, PR title, and PR body:
- name: Commit with dynamic message
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'build: deploy {{sha:short}} to {{branch}} on {{date}}'
commit_body: 'Triggered by {{actor}} in run #{{run_number}}'
Available variables:
| Variable | Description | Example |
|---|---|---|
{{date}} |
Current date (YYYY-MM-DD) | 2026-03-31 |
{{datetime}} |
Current ISO datetime | 2026-03-31T14:30:00.000Z |
{{sha}} |
Current HEAD SHA | abc123def456... |
{{sha:short}} |
Short HEAD SHA (7 chars) | abc123d |
{{branch}} |
Target branch name | main |
{{run_id}} |
GitHub Actions run ID | 12345678 |
{{run_number}} |
GitHub Actions run number | 42 |
{{actor}} |
GitHub actor (user/bot) | octocat |
{{repository}} |
Repository (owner/name) | maxgfr/my-repo |
- name: Commit in subdirectory
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update package'
work_dir: 'packages/my-package'
- name: Commit with body
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'feat: add new feature'
commit_body: |
This commit adds the new feature X.
Closes #123
Stage all files but exclude sensitive ones:
- name: Commit all except secrets
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update config'
exclude_files: '*.env .secrets credentials.json'
Read the list of files to stage from a file generated by a previous step:
- name: Generate file list
run: |
echo "src/generated.ts" > files-to-commit.txt
echo "src/types.ts" >> files-to-commit.txt
- name: Commit listed files
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update generated files'
pathspec_from_file: 'files-to-commit.txt'
Push to a new branch that doesn't exist yet:
- name: Commit to new branch
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'feat: new feature'
branch: 'feature/my-feature'
create_branch: 'true'
- name: Amend last commit
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: updated message'
amend: 'true'
force_push: 'true'
- name: Commit and tag
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'release: v1.0.0'
tag: 'v1.0.0'
tag_message: 'Release version 1.0.0'
- name: Commit with specific date
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: backfill data'
commit_timestamp: '2024-01-01T00:00:00Z'
When force_push is disabled and the remote has diverged, automatically pull with rebase and retry:
- name: Commit with retry
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update shared file'
force_push: 'false'
retry_on_conflict: 'true'
max_retries: '5'
max_retries counts the retries after the first push attempt, so max_retries: '5' allows up to 6 push attempts in total.
Preview what would be committed without actually committing:
- name: Dry run
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'test: dry run'
dry_run: 'true'
Create multiple commits in a single action run:
- name: Multi-commit
uses: maxgfr/github-commit-push-file@main
with:
commits: |
[
{"message": "chore: update config", "files": "config.json"},
{"message": "feat: add feature", "files": "src/feature.ts src/types.ts"},
{"message": "docs: update readme", "files": "README.md"}
]
force_push: 'true'
branch: 'automated-updates'
Each commit object supports message (required), files (required), and body (optional).
Note: in multi-commit mode, every commit must declare its own
files. There is no fallback to the top-levelfilesinput: with the-Adefault,git add -Awould stage the whole worktree and swallow files intended for the following commits. The action fails with an explicit error if a commit omitsfiles.
Push to a branch and automatically create a PR:
- name: Commit and create PR
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'feat: automated update'
branch: 'auto-update'
create_branch: 'true'
create_pr: 'true'
pr_title: 'Automated update {{date}}'
pr_body: 'This PR was created automatically by {{actor}}.'
pr_base_branch: 'main'
pr_labels: 'automated, enhancement'
pr_draft: 'false'
token: ${{ secrets.GITHUB_TOKEN }}
The head branch must be different from the base branch: the action fails before calling the GitHub API if they resolve to the same branch.
Limitation: cross-fork pull requests are not supported. The action always pushes to the repository it runs in (
GITHUB_REPOSITORY) and passes the head as a bare branch name (noowner:branchprefix), so the head branch must live in the same repository as the base branch.
- name: Signed commit
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: signed update'
sign_commit: 'true'
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Commit with custom author
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: automated update'
author_name: 'My Bot'
author_email: 'bot@example.com'
- name: Commit and push
id: commit
uses: maxgfr/github-commit-push-file@main
with:
commit_message: 'chore: update'
skip_if_no_changes: 'true'
- name: Use outputs
if: steps.commit.outputs.committed == 'true'
run: |
echo "Commit SHA: ${{ steps.commit.outputs.commit_sha }}"
echo "Commit URL: ${{ steps.commit.outputs.commit_url }}"
echo "Changed files: ${{ steps.commit.outputs.changed_files }}"
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
commit_message |
string | yes* | - | The commit message. Supports template variables. *Not required if commits is provided. |
commit_body |
string | no | '' |
Optional commit body (appended after a blank line). Supports template variables. |
files |
string | no | -A |
Files to add (space-separated). Use -A for all files. Supports quoted paths and glob patterns. |
branch |
string | no | current branch | Target branch to push to. |
author_name |
string | no | GITHUB_ACTOR |
The name of the commit author. |
author_email |
string | no | GITHUB_ACTOR@users.noreply.github.com |
The email of the commit author. |
sign_commit |
boolean | no | false |
Whether to sign the commit with GPG. |
gpg_private_key |
string | no | - | GPG private key (base64 encoded) for signing commits. |
gpg_passphrase |
string | no | - | Passphrase for the GPG private key. |
force_push |
boolean | no | true |
Whether to force push. |
skip_if_no_changes |
boolean | no | true |
Skip commit and push if there are no changes. |
skip_hooks |
boolean | no | true |
Whether to skip git hooks (--no-verify) on commit. |
work_dir |
string | no | repository root | Working directory to execute git commands in. |
dry_run |
boolean | no | false |
Show what would be committed without actually committing or pushing. |
tag |
string | no | - | Optional tag to create on the commit. |
tag_message |
string | no | - | Message for annotated tag (if empty, creates a lightweight tag). |
create_branch |
boolean | no | false |
Create the target branch if it does not exist on the remote. |
amend |
boolean | no | false |
Amend the last commit instead of creating a new one. Cannot be used with commits. |
commit_timestamp |
string | no | - | Override commit date. Accepts any git-compatible date format (e.g. 2024-01-01T00:00:00Z). |
exclude_files |
string | no | - | Files/patterns to exclude from staging (space-separated). Applied after git add. |
pathspec_from_file |
string | no | - | Path to a file containing the list of files to add (one per line). Takes precedence over files. |
commits |
string | no | - | JSON array of commits to make: [{message, files, body?}]. Each commit must declare its own files. |
retry_on_conflict |
boolean | no | false |
Retry push with pull --rebase if it fails (only when force_push is false). |
max_retries |
number | no | 3 |
Number of push retries after the initial attempt fails (total attempts = max_retries + 1). |
create_pr |
boolean | no | false |
Create a pull request after pushing. Requires token. |
pr_title |
string | no | commit message | Title for the pull request. Supports template variables. |
pr_base_branch |
string | no | repo default branch | Base branch for the pull request. |
pr_body |
string | no | - | Body for the pull request. Supports template variables. |
pr_labels |
string | no | - | Comma-separated list of labels to add to the pull request. |
pr_draft |
boolean | no | false |
Create the pull request as a draft. |
token |
string | no | - | GitHub token for authentication (used for push auth and PR creation). |
| Name | Type | Description |
|---|---|---|
commit_name |
string | Deprecated: Use commit_message instead. |
| Name | Type | Description |
|---|---|---|
committed |
string | Whether a commit was made (true or false). |
commit_sha |
string | The SHA of the last commit (empty if no commit was made). |
commit_shas |
string | JSON array of all commit SHAs (useful with multi-commit). |
commit_url |
string | The GitHub URL of the last commit. |
changed_files |
string | JSON array of files changed across all commits. |
pr_url |
string | The URL of the created pull request (if create_pr was used). |
pr_number |
string | The number of the created pull request (if create_pr was used). |
To use GPG commit signing:
Generate a GPG key (if you don't have one):
gpg --full-generate-key
Export your private key (base64 encoded):
gpg --armor --export-secret-keys YOUR_KEY_ID | base64 -w 0
Add the key to GitHub Secrets:
GPG_PRIVATE_KEY with the base64-encoded keyGPG_PASSPHRASE with your key's passphrase (if any)Add the public key to your GitHub account:
gpg --armor --export YOUR_KEY_IDMIT
maxgfr/github-commit-push-file is a public repo on GitHub by maxgfr. Github action which lets you to commit and push a file to a repository.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-04. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Git hooks made easy 🐶 woof!
A modern file manager that helps users organize their files and folders.
:octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub.

A self-hosted, browser-based AI CSV analyzer
My GitHub stars, sorted by AI and searchable, rebuilt daily by starsmith

Self-hosted fundamental stock screener — 150k+ equities, zero API keys forever. Transparent scores: Piotroski, Altman, Ohlson, Zmijewski, Beneish, Montier, Greenblatt magic formula, Graham — full provenance, DuckDB-fast (<1s full-universe).
Client-side database schema visualizer with AI-powered analysis. Upload SQL, visualize, share, export. No backend needed.
Github action which lets you to change a value from a json file (e.g. package.json)