mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-08-02 08:36:09 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
296e083b4c | ||
|
871ade1c45 | ||
|
75625df4f3 | ||
|
3870982ac5 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -4,15 +4,21 @@ 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.9.0...HEAD)
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.9.1...HEAD)
|
||||
|
||||
> TBD
|
||||
|
||||
|
||||
## [v4.9.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.9.0...v4.9.1) - 2021-02-23
|
||||
|
||||
### Changed
|
||||
- Revert changes made in v4.9.0. A branch will no longer be automatically generated. [#144](https://github.com/stefanzweifel/git-auto-commit-action/pull/144)
|
||||
|
||||
|
||||
## [v4.9.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.8.0...v4.9.0) - 2021-02-20
|
||||
|
||||
### Changed
|
||||
- Automatically create btanch if a branch with the given name does not exist [#140](https://github.com/stefanzweifel/git-auto-commit-action/pull/140)
|
||||
- Automatically create branch if a branch with the given name does not exist [#140](https://github.com/stefanzweifel/git-auto-commit-action/pull/140)
|
||||
|
||||
|
||||
## [v4.8.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.2...v4.8.0) - 2020-12-15
|
||||
|
@@ -48,28 +48,9 @@ _switch_to_branch() {
|
||||
git fetch --depth=1;
|
||||
fi
|
||||
|
||||
|
||||
# If INPUT_BRANCH is empty, just run `git checkout`
|
||||
if [ -z "$INPUT_BRANCH" ]
|
||||
then
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
else
|
||||
# If the branch which we should checkout already exists, just
|
||||
# run `git checkout $INPUT_BRANCH`
|
||||
# Otherwhise create a new branch by adding the `-b` option to
|
||||
# `git-checkout`
|
||||
# shellcheck disable=SC2086
|
||||
if [ -n "$(git branch --list $INPUT_BRANCH)" ]
|
||||
then
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
git checkout -b $INPUT_BRANCH;
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_add_files() {
|
||||
|
@@ -5,9 +5,9 @@ load '../node_modules/bats-assert/load'
|
||||
|
||||
setup() {
|
||||
# Define Paths for local repository used during tests
|
||||
export FAKE_LOCAL_REPOSITORY="${BATS_TEST_DIRNAME}/test_fake_local_repository"
|
||||
export FAKE_REMOTE="${BATS_TEST_DIRNAME}/test_fake_remote_repository"
|
||||
export FAKE_TEMP_LOCAL_REPOSITORY="${BATS_TEST_DIRNAME}/test_fake_temp_local_repository"
|
||||
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"
|
||||
|
||||
# Set default INPUT variables used by the GitHub Action
|
||||
export INPUT_REPOSITORY="${FAKE_LOCAL_REPOSITORY}"
|
||||
@@ -331,25 +331,3 @@ git_auto_commit() {
|
||||
|
||||
assert_line "::debug::git-fetch has not been executed"
|
||||
}
|
||||
|
||||
@test "If INPUT_BRANCH is set and the branch does not exist it creates one" {
|
||||
INPUT_BRANCH="new-branch"
|
||||
|
||||
run git branch
|
||||
refute_line "new-branch"
|
||||
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
|
||||
|
||||
run git_auto_commit
|
||||
|
||||
assert_success
|
||||
|
||||
assert_line "INPUT_BRANCH value: new-branch"
|
||||
assert_line --partial "::debug::Push commit to remote branch new-branch"
|
||||
|
||||
# Assert that branch "new-branch" was updated on remote
|
||||
current_sha="$(git rev-parse --verify --short new-branch)"
|
||||
remote_sha="$(git rev-parse --verify --short origin/new-branch)"
|
||||
|
||||
assert_equal $current_sha $remote_sha
|
||||
}
|
||||
|
Reference in New Issue
Block a user