Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stefanzweifel/git-auto-commit-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.0.0
Choose a base ref
...
head repository: stefanzweifel/git-auto-commit-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.1
Choose a head ref
  • 14 commits
  • 8 files changed
  • 8 contributors

Commits on Oct 6, 2023

  1. Update CHANGELOG

    stefanzweifel authored and github-actions[bot] committed Oct 6, 2023
    Copy the full SHA
    e27a689 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    eb38c21 View commit details
  3. Use v5 in README

    stefanzweifel committed Oct 6, 2023

    Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
    Copy the full SHA
    98d2782 View commit details
  4. Copy the full SHA
    e8f94e4 View commit details

Commits on Dec 12, 2023

  1. Copy the full SHA
    8036286 View commit details
  2. Little Doc Updates

    stefanzweifel committed Dec 12, 2023
    Copy the full SHA
    8d90676 View commit details
  3. Copy the full SHA
    2818fe7 View commit details
  4. Remove outdated docs

    stefanzweifel committed Dec 12, 2023
    Copy the full SHA
    29183a2 View commit details

Commits on Dec 24, 2023

  1. Clarify commit_author input option (#315)

    * Clarify `commit_author` input option
    
    * Update README.md
    
    ---------
    
    Co-authored-by: Stefan Zweifel <stefanzweifel@users.noreply.github.com>
    npanuhin and stefanzweifel authored Dec 24, 2023
    Copy the full SHA
    12f6863 View commit details

Commits on Feb 6, 2024

  1. Copy the full SHA
    4d160c5 View commit details

Commits on Feb 22, 2024

  1. Linux is not UNIX (#321)

    couling authored Feb 22, 2024
    Copy the full SHA
    e040c59 View commit details

Commits on Mar 15, 2024

  1. Add step id explanation for output in README.md (#324)

    ChristianVermeulen authored Mar 15, 2024
    Copy the full SHA
    9b5e5ee View commit details

Commits on Mar 26, 2024

  1. Bump bats from 1.10.0 to 1.11.0 (#325)

    Bumps [bats](https://github.com/bats-core/bats-core) from 1.10.0 to 1.11.0.
    - [Release notes](https://github.com/bats-core/bats-core/releases)
    - [Changelog](https://github.com/bats-core/bats-core/blob/master/docs/CHANGELOG.md)
    - [Commits](bats-core/bats-core@v1.10.0...v1.11.0)
    
    ---
    updated-dependencies:
    - dependency-name: bats
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 26, 2024
    Copy the full SHA
    b0f4d47 View commit details

Commits on Apr 11, 2024

  1. Fail if attempting to execute git commands in a directory that is not…

    … a git-repo. (#326)
    
    * Fail (and log message) if attempting to execute git commands in a directory that is not a git-repo.
    
    * Add Test
    
    * Code Formatting
    
    ---------
    
    Co-authored-by: Constantin Comendant <constantin@uberagent.com>
    Co-authored-by: Stefan Zweifel <stefan@stefanzweifel.dev>
    3 people authored Apr 11, 2024
    Copy the full SHA
    8621497 View commit details
Showing with 94 additions and 95 deletions.
  1. +1 −1 .github/workflows/release-drafter.yml
  2. +1 −1 .github/workflows/update-changelog.yaml
  3. +22 −1 CHANGELOG.md
  4. +44 −86 README.md
  5. +8 −1 entrypoint.sh
  6. +1 −1 package.json
  7. +13 −0 tests/git-auto-commit.bats
  8. +4 −4 yarn.lock
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@ jobs:
contents: write

steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/update-changelog.yaml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ jobs:
latest-version: ${{ github.event.release.name }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: master
commit_message: Update CHANGELOG
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,10 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.16.0...HEAD)
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v5.0.0...HEAD)

> TBD
## [v5.0.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.16.0...v5.0.0) - 2023-10-06

New major release that bumps the default runtime to Node 20. There are no other breaking changes.

### Changed

- Update node version to node20 ([#300](https://github.com/stefanzweifel/git-auto-commit-action/pull/300)) [@ryudaitakai](https://github.com/@ryudaitakai)
- Add _log and _set_github_output functions ([#273](https://github.com/stefanzweifel/git-auto-commit-action/pull/273)) [@stefanzweifel](https://github.com/@stefanzweifel)

### Fixed

- Seems like there is an extra space ([#288](https://github.com/stefanzweifel/git-auto-commit-action/pull/288)) [@pedroamador](https://github.com/@pedroamador)
- Fix git-auto-commit.yml ([#277](https://github.com/stefanzweifel/git-auto-commit-action/pull/277)) [@zcong1993](https://github.com/@zcong1993)

### Dependency Updates

- Bump actions/checkout from 3 to 4 ([#302](https://github.com/stefanzweifel/git-auto-commit-action/pull/302)) [@dependabot](https://github.com/@dependabot)
- Bump bats from 1.9.0 to 1.10.0 ([#293](https://github.com/stefanzweifel/git-auto-commit-action/pull/293)) [@dependabot](https://github.com/@dependabot)
- Bump github/super-linter from 4 to 5 ([#289](https://github.com/stefanzweifel/git-auto-commit-action/pull/289)) [@dependabot](https://github.com/@dependabot)
- Bump bats from 1.8.2 to 1.9.0 ([#282](https://github.com/stefanzweifel/git-auto-commit-action/pull/282)) [@dependabot](https://github.com/@dependabot)

## [v4.16.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.4...v4.16.0) - 2022-12-02

### Changed
130 changes: 44 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ Adding git-auto-commit to your Workflow only takes a couple lines of code.
2. Add the following step at the end of your job, after other steps that might add or change files.

```yaml
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
```
Your Workflow should look similar to this example.
@@ -44,16 +44,16 @@ jobs:
# Other steps that change files in the repository

# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
```
> **Note**
> The Action has to be used in a Job that runs on a UNIX system (e.g. `ubuntu-latest`).
> [!NOTE]
> The Action has to be used in a Job that runs on a UNIX-like system (e.g. `ubuntu-latest`).

The following is an extended example with all available options.

```yaml
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
# Optional. Commit message for the created commit.
# Defaults to "Apply automatic changes"
@@ -82,7 +82,7 @@ The following is an extended example with all available options.
# Optional commit user and author settings
commit_user_name: My GitHub Actions Bot # defaults to "github-actions[bot]"
commit_user_email: my-github-actions-bot@example.org # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
commit_author: Author <actions@github.com> # defaults to author of the commit that triggered the run
commit_author: Author <actions@github.com> # defaults to "username <username@users.noreply.github.com>", where "username" belongs to the author of the commit that triggered the run

# Optional. Tag name being created in the local repository and
# pushed to remote repository and defined branch.
@@ -151,7 +151,7 @@ jobs:
- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply php-cs-fixer changes
```
@@ -167,9 +167,16 @@ You can use these outputs to trigger other Actions in your Workflow run based on
- `changes_detected`: Returns either "true" or "false" if the repository was dirty and files have changed.
- `commit_hash`: Returns the full hash of the commit if one was created.

**⚠️ When using outputs, the step needs to be given an id. See example below.**

### Example

```yaml
- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action #mandatory for the output to show up in ${{ steps }}
with:
commit_message: Apply php-cs-fixer changes
- name: "Run if changes have been detected"
if: steps.auto-commit-action.outputs.changes_detected == 'true'
run: echo "Changes!"
@@ -258,7 +265,7 @@ The example below can be used as a starting point to generate a multiline commit
# Quick and dirty step to get rid of the temporary file holding the commit message
- run: rm -rf commitmessage.txt
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
id: commit
with:
commit_message: ${{ steps.commit_message_step.outputs.commit_message }}
@@ -270,33 +277,38 @@ Using command lines options needs to be done manually for each workflow which yo

- [Import GPG Signature](https://github.com/crazy-max/ghaction-import-gpg) (Suggested by [TGTGamer](https://github.com/tgtgamer))

### Push to forks from private repositories
### Use in forks from private repositories

By default, GitHub Actions doesn't run Workflows on forks from private repositories. To enable Actions for **private** repositories enable "Run workflows from pull requests" in your repository settings.
By default, GitHub Actions doesn't run Workflows on forks from **private** repositories. To enable Actions for **private** repositories enable "Run workflows from pull requests" in your repository settings.

See [this announcement from GitHub](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) or the [GitHub docs](https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#enabling-workflows-for-private-repository-forks) for details.


### Use in forks from public repositories

<details>
<summary>Expand to learn more</summary>

> **Note**
> [!NOTE]
> This Action technically works with forks. However, please note that the combination of triggers and their options can cause issues. Please read [the documentation](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows) on which triggers GitHub Actions support.\
> Ensure your contributors enable "Allow edits by maintainers" when opening a pull request. ([Learn more](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)) \
> \
> **If you use this Action in combination with a linter/fixer, it's easier if you run the Action on `push` on your `main`-branch.**

> **Warning**
> [!WARNING]
> Due to limitations of GitHub, this Action currently can't push commits to a base repository, if the fork _lives_ under an organisation. See [github/community#6634](https://github.com/orgs/community/discussions/5634) and [this comment](https://github.com/stefanzweifel/git-auto-commit-action/issues/211#issuecomment-1428849944) for details.

By default, this Action will not run on Pull Requests which have been opened by forks. (This is a limitation by GitHub, not by us.)
However, there are a couple of ways to use this Actions in Workflows that should be triggered by forked repositories.

### Workflow should run in **base** repository

The workflow below runs whenever a commit is pushed to the `main`-branch or when activity on a pull request happens, by listening to the [`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) event.
> [!CAUTION]
> The following section explains how you can use git-auto-commit in combination with the `pull_request_target` trigger.
> **Using `pull_request_target` in your workflows can lead to repository compromise as [mentioned](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) by GitHub's own security team. This means, that a bad actor could potentially leak/steal your GitHub Actions repository secrets.**
> Please be aware of this risk when using `pull_request_target` in your workflows.
>
> If your workflow runs code-fixing tools, consider running the workflow on your default branch by listening to the `push` event or use a third-party tool like [autofix.ci](https://autofix.ci/).
> We keep this documentation around, as many questions came in over the years, on how to use this action for public forks.

The workflow below runs whenever a commit is pushed to the `main`-branch or when activity on a pull request happens, by listening to the [`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) event.

If the workflow is triggered by the `pull_request_target`-event, the workflow will run in the context of the base of the pull request, rather than in the context of the merge commit, as the `pull_request` event does.
In other words, this will allow your workflow to be run in the repository where the pull request is opened to and will push changes back to the fork.
@@ -333,76 +345,23 @@ jobs:
- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga
- uses: stefanzweifel/git-auto-commit-action@v4
```

### Workflow should run in **forked** repository

> **Warning**
> **This part of the documentation is outdated.**
> We were not able to configure a GitHub Action workflow for forks, that the workflow would run in the fork / head repository.
> Please let us know in the [discussions](https://github.com/stefanzweifel/git-auto-commit-action/discussions)-area, if and how you achieved that.

If the workflow should run in the forked repository, follow these steps:

1. In addition to listening to the `pull_request` event in your Workflow triggers, you have to add an additional event: `pull_request_target`. You can learn more about this event in [the GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target).
2. GitHub Action has to be enabled on the forked repository. \
For security reasons, GitHub does not automatically enable GitHub Actions on forks. The user has to explicitly enable GitHub Actions in the "Actions"-tab of the forked repository. (Mention this in your projects README or CONTRIBUTING.md!)

After you have added the `pull_request_target` to your desired Workflow and the forked repository has enabled Actions and a new Pull Request is opened, the Workflow will run **on the forked repository**.

Due to the fact that the Workflow is not run on the repository the Pull Request is opened in, you won't see any status indicators inside the Pull Request.

#### Example

The following workflow runs `php-cs-fixer` (a code linter and fixer for PHP) when a `pull_request` is opened. We've added the `pull_request_target`-trigger too, to make it work for forks.

```yaml
name: Format PHP
on: [push, pull_request, pull_request_target]
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply php-cs-fixer changes
- uses: stefanzweifel/git-auto-commit-action@v5
```

Next time a user forks your project **and** enabled GitHub Actions **and** opened a Pull Request, the Workflow will run on the **forked** repository and will push commits to the same branch.

Here's how the Pull Request will look like:

![Screenshot of a Pull Request from a Fork](https://user-images.githubusercontent.com/1080923/90955964-9c74c080-e482-11ea-8097-aa7f5161f50e.png)


As you can see, your contributors have to go through hoops to make this work. **For Workflows which run linters and fixers (like the example above) we recommend running them when a push happens on the `main`-branch.**


For more information about running Actions on forks, see [this announcement from GitHub](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/).

</details>

### Using `--amend` and `--no-edit` as commit options

<details>
<summary>Expand to learn more</summary>

If you would like to use this Action to create a commit using [`--amend`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---amend) and [`--no-edit`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---no-edit) you need to make some adjustments.

> **Warning**
> [!CAUTION]
> You should understand the implications of rewriting history if you amend a commit that has already been published. [See rebasing](https://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase).

First, you need to extract the previous commit message by using `git log -1 --pretty=%s`.
Then you need to provide this last commit message to the Action through the `commit_message` input option.

By default, the commit author is changed to `username <username@users.noreply.github.com>`, where `username` is the name of the user who triggered the workflow (The [`github.actor`](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context) context is used here). If you want to preserve the name and email of the original author, you must extract them from the last commit and provide them to the Action through the `commit_author` input option.

Finally, you have to use `push_options: '--force'` to overwrite the git history on the GitHub remote repository. (git-auto-commit will not do a `git-rebase` for you!)

The steps in your workflow might look like this:
@@ -416,22 +375,22 @@ The steps in your workflow might look like this:
# Other steps in your workflow to trigger a changed file
- name: Get last commit message
id: last-commit-message
id: last-commit
run: |
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ steps.last-commit-message.outputs.msg }}
commit_author: ${{ steps.last-commit.outputs.author }}
commit_message: ${{ steps.last-commit.outputs.message }}
commit_options: '--amend --no-edit'
push_options: '--force'
skip_fetch: true
```
See discussion in [#159](https://github.com/stefanzweifel/git-auto-commit-action/issues/159#issuecomment-845347950) for details.
</details>

## Troubleshooting
### Action does not push commit to repository
@@ -458,14 +417,13 @@ store the token as a secret in your repository and pass the new token to the [`a
```
You can learn more about Personal Access Token in the [GitHub documentation](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token).
> **Note**
> [!TIP]
> If you're working in an organisation, and you don't want to create the PAT from your personal account, we recommend using a bot-account for such tokens.

If you go the "force pushes" route, you have to enable force pushes to a protected branch (See [documentation](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)) and update your Workflow to use force push like this.
If you go the "force pushes" route, you have to enable force pushes to a protected branch (see [documentation](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)) and update your Workflow to use force push like this.
```yaml
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply php-cs-fixer changes
push_options: --force
@@ -477,7 +435,7 @@ This is due to limitations set up by GitHub, [commits made by this Action do not
### Pathspec 'x' did not match any files
If you're using the Action with a custom `file_pattern` and the Action throws a fatal error with the message "Pathspec 'file-pattern' did not match any files", the problem is probably that no file for the pattern exists in the repository.
If you're using the Action with a custom `file_pattern` and the Action throws a fatal error with the message "Pathspec 'file-pattern' did not match any files", the problem is probably that no file for the pattern **exists** in the repository.
`file_pattern` is used both for `git-status` and `git-add` in this Action. `git-add` will throw a fatal error, if for example, you use a file pattern like `*.js *.ts` but no `*.ts` files exist in your projects' repository.
@@ -495,7 +453,7 @@ This is due to the fact, that the `*.md`-glob is expanded before sending it to `
To fix this add `disable_globbing: true` to your Workflow.
```yaml
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: '*.md'
disable_globbing: true
@@ -523,7 +481,7 @@ yarn test
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/stefanzweifel/git-auto-commit-action/tags).
We also provide major version tags to make it easier to always use the latest release of a major version. For example, you can use `stefanzweifel/git-auto-commit-action@v4` to always use the latest release of the current major version.
We also provide major version tags to make it easier to always use the latest release of a major version. For example, you can use `stefanzweifel/git-auto-commit-action@v5` to always use the latest release of the current major version.
(More information about this [here](https://help.github.com/en/actions/building-actions/about-actions#versioning-your-action).)
## Credits
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -82,8 +82,15 @@ _git_is_dirty() {
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}";
read -r -a INPUT_FILE_PATTERN_EXPANDED <<< "$INPUT_FILE_PATTERN";

# capture stderr
gitStatusMessage="$((git status -s $INPUT_STATUS_OPTIONS -- ${INPUT_FILE_PATTERN_EXPANDED:+${INPUT_FILE_PATTERN_EXPANDED[@]}} >/dev/null ) 2>&1)";
# shellcheck disable=SC2086
[ -n "$(git status -s $INPUT_STATUS_OPTIONS -- ${INPUT_FILE_PATTERN_EXPANDED:+${INPUT_FILE_PATTERN_EXPANDED[@]}})" ]
gitStatus="$(git status -s $INPUT_STATUS_OPTIONS -- ${INPUT_FILE_PATTERN_EXPANDED:+${INPUT_FILE_PATTERN_EXPANDED[@]}})";
if [ $? -ne 0 ]; then
_log "error" "git-status failed with:<$gitStatusMessage>";
exit 1;
fi
[ -n "$gitStatus" ]
}
_switch_to_branch() {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"bats": "^1.10.0",
"bats": "^1.11.0",
"bats-assert": "ztombol/bats-assert",
"bats-support": "ztombol/bats-support"
},
13 changes: 13 additions & 0 deletions tests/git-auto-commit.bats
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ setup() {
export FAKE_LOCAL_REPOSITORY="${BATS_TEST_DIRNAME}/tests_local_repository"
export FAKE_REMOTE="${BATS_TEST_DIRNAME}/tests_remote_repository"
export FAKE_TEMP_LOCAL_REPOSITORY="${BATS_TEST_DIRNAME}/tests_clone_of_remote_repository"
export FAKE_FOLDER_WITHOUT_GIT_REPO="/tmp/tests_folder_without_git_repo"

# While it is likely the GitHub hosted runners will use master as the default branch,
# locally anyone may change that. So for tests lets grab whatever is currently set
@@ -58,6 +59,7 @@ teardown() {
rm -rf "${FAKE_LOCAL_REPOSITORY}"
rm -rf "${FAKE_REMOTE}"
rm -rf "${FAKE_TEMP_LOCAL_REPOSITORY}"
rm -rf "${INPUT_REPOSITORY}"

if [ -z ${GITHUB_OUTPUT+x} ]; then
echo "GITHUB_OUTPUT is not set"
@@ -1112,3 +1114,14 @@ END
run git log -n 1
assert_output --partial $COMMIT_MESSAGE
}

@test "It exits with error message if entrypoint.sh is being run not in a git repository" {
INPUT_REPOSITORY="${FAKE_FOLDER_WITHOUT_GIT_REPO}"

mkdir "${INPUT_REPOSITORY}"

run git_auto_commit

assert_failure;
assert_line "::error::git-status failed with:<fatal: not a git repository (or any of the parent directories): .git>"
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ bats-support@ztombol/bats-support:
version "0.3.0"
resolved "https://codeload.github.com/ztombol/bats-support/tar.gz/004e707638eedd62e0481e8cdc9223ad471f12ee"

bats@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/bats/-/bats-1.10.0.tgz#d22cb6e2d88fd39302167da237d710406d1587ce"
integrity sha512-yOQrC7npuCrN+Ic3TyjTjJlzHa0qlK3oEO6VAYPWwFeutx/GmpljIyB6uNSl/UTASyc2w4FgVuA/QMMf9OdsCw==
bats@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/bats/-/bats-1.11.0.tgz#40281f021f5befcc10da54ed5674aa5b181f4953"
integrity sha512-qiKdnS4ID3bJ1MaEOKuZe12R4w+t+psJF0ICj+UdkiHBBoObPMHv8xmD3w6F4a5qwUyZUHS+413lxENBNy8xcQ==