Skip to content

Commit

Permalink
Merge pull request #42 from devops-infra/bugfix/prefix
Browse files Browse the repository at this point in the history
Set commit_prefix to empty by default
  • Loading branch information
ChristophShyper authored Mar 16, 2022
2 parents d0faf30 + 19e320c commit 65b53ad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
phony: help

# Release tag for the action
VERSION := v0.8.2
VERSION := v0.8.3

# GitHub Actions bogus variables
GITHUB_REF ?= refs/heads/null
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ Features:
```
| Input Variable | Required | Default | Description |
| ------------------- | -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| github_token | Yes | `""` | Personal Access Token for GitHub for pushing the code. |
| add_timestamp | No | `false` | Whether to add the timestamp to a new branch name. Used when `target_branch` is set. Uses format `%Y-%m-%dT%H-%M-%SZ`. |
| amend | No | `false` | Whether to make amendment to the previous commit (`--amend`). Cannot be used together with `commit_message` or `commit_prefix`. |
| commit_prefix | No | `[AUTO-COMMIT]` | Prefix added to commit message. If `commit_message` is not used. |
| commit_message | No | `""` | Full commit message to set. Cannot be used together with `amend`. |
| force | No | `false` | Whether to use force push for fast-forward changes (`--force`). Use only if necessary, e.g. when using `--amend`. |
| no_edit | No | `false` | Whether to not edit commit message when using amend (`--no-edit`). |
| organization_domain | No | `github.com` | Github Enterprise domain name. |
| target_branch | No | *current branch* | Name of a new branch to push the code into. Creates branch if not existing. |
| Input Variable | Required | Default | Description |
| ------------------- | -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| github_token | Yes | `""` | Personal Access Token for GitHub for pushing the code. |
| add_timestamp | No | `false` | Whether to add the timestamp to a new branch name. Used when `target_branch` is set. Uses format `%Y-%m-%dT%H-%M-%SZ`. |
| amend | No | `false` | Whether to make amendment to the previous commit (`--amend`). Cannot be used together with `commit_message` or `commit_prefix`. |
| commit_prefix | No | `""` | Prefix added to commit message. If `commit_message` is not used. |
| commit_message | No | `""` | Full commit message to set. Cannot be used together with `amend`. |
| force | No | `false` | Whether to use force push for fast-forward changes (`--force`). Use only if necessary, e.g. when using `--amend`. And set `fetch-depth: 0` for `actions/checkout`. |
| no_edit | No | `false` | Whether to not edit commit message when using amend (`--no-edit`). |
| organization_domain | No | `github.com` | Github Enterprise domain name. |
| target_branch | No | *current branch* | Name of a new branch to push the code into. Creates branch if not existing. |

| Outputs | Description |
| ------------- | ------------------------------------------------------------------------ |
Expand All @@ -82,7 +82,7 @@ jobs:
run: |
find . -type f -name "*" -print0 | xargs -0 sed -i "s/foo/bar/g"
- name: Commit and push changes
uses: devops-infra/[email protected].2
uses: devops-infra/[email protected].3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: Replaced foo with bar
Expand All @@ -103,7 +103,7 @@ jobs:
run: |
find . -type f -name "*" -print0 | xargs -0 sed -i "s/foo/bar/g"
- name: Commit and push changes
uses: devops-infra/[email protected].2
uses: devops-infra/[email protected].3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_prefix: "[AUTO-COMMIT] foo/bar replace"
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ inputs:
commit_prefix:
description: Prefix added to commit message
required: false
default: "[AUTO-COMMIT]"
default: ""
commit_message:
description: Full commit message to set
required: false
Expand Down Expand Up @@ -45,7 +45,7 @@ outputs:
description: Name of the branch code was pushed into
runs:
using: docker
image: docker://devopsinfra/action-commit-push:v0.8.2
image: docker://devopsinfra/action-commit-push:v0.8.3
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
branding:
Expand Down
4 changes: 1 addition & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ fi

# Get changed files
git add -A
FILES_MODIFIED=$(git diff --name-status)
FILES_ADDED=$(git diff --staged --name-status)
FILES_CHANGED=$(echo -e "${FILES_MODIFIED}\n${FILES_ADDED}")
FILES_CHANGED=$(git diff --staged --name-status)
if [[ -n ${FILES_CHANGED} ]]; then
echo -e "\n[INFO] Files changed:\n${FILES_CHANGED}"
else
Expand Down

0 comments on commit 65b53ad

Please sign in to comment.