mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-08-03 00:56:08 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9b7c21583c | ||
|
4cc90c7784 | ||
|
367938329d | ||
|
25cac34d8d | ||
|
30cd17bff0 | ||
|
65928d2898 | ||
|
6b4ef1444c | ||
|
55291ea168 | ||
|
2b5c86365b | ||
|
ff28943460 |
26
.github/workflows/integration-tests.yml
vendored
Normal file
26
.github/workflows/integration-tests.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Integration Tests
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-commit-works:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
- name: Add Files
|
||||||
|
run: touch {a,b,c}.txt
|
||||||
|
|
||||||
|
- name: Run git-auto-commit
|
||||||
|
id: "auto-commit-action"
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
branch: ci-test
|
||||||
|
commit_message: Message
|
||||||
|
checkout_options: -b
|
||||||
|
|
||||||
|
- name: Delete Branch
|
||||||
|
run: git push -d origin ci-test
|
@@ -4,11 +4,17 @@ 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/)
|
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).
|
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.6.0...HEAD)
|
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.1...HEAD)
|
||||||
|
|
||||||
> TBD
|
> TBD
|
||||||
|
|
||||||
|
|
||||||
|
## [v4.7.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.0...v4.7.1) - 2020-10-12
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Remove `checkout_options` as it broke everything [#120](https://github.com/stefanzweifel/git-auto-commit-action/pull/120/)
|
||||||
|
|
||||||
|
|
||||||
## [v4.7.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.6.0...v4.7.0) - 2020-10-11
|
## [v4.7.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.6.0...v4.7.0) - 2020-10-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@@ -5,6 +5,9 @@
|
|||||||
<a href="https://github.com/stefanzweifel/git-auto-commit-action/actions?query=workflow%3Atests">
|
<a href="https://github.com/stefanzweifel/git-auto-commit-action/actions?query=workflow%3Atests">
|
||||||
<img src="https://github.com/stefanzweifel/git-auto-commit-action/workflows/tests/badge.svg" alt="">
|
<img src="https://github.com/stefanzweifel/git-auto-commit-action/workflows/tests/badge.svg" alt="">
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://github.com/stefanzweifel/git-auto-commit-action/actions?query=workflow%3A%22Integration+Tests%22">
|
||||||
|
<img src="https://github.com/stefanzweifel/git-auto-commit-action/workflows/Integration%20Tests/badge.svg" alt="">
|
||||||
|
</a>
|
||||||
|
|
||||||
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the commit back to GitHub.
|
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the commit back to GitHub.
|
||||||
The default committer is "GitHub Actions <actions@github.com>", and the default author of the commit is "Your GitHub Username <github_username@users.noreply.github.com>".
|
The default committer is "GitHub Actions <actions@github.com>", and the default author of the commit is "Your GitHub Username <github_username@users.noreply.github.com>".
|
||||||
@@ -53,9 +56,6 @@ Add the following step at the end of your job, after other steps that might add
|
|||||||
|
|
||||||
# Optional: Disable dirty check and always try to create a commit and push
|
# Optional: Disable dirty check and always try to create a commit and push
|
||||||
skip_dirty_check: true
|
skip_dirty_check: true
|
||||||
|
|
||||||
# Optional: Allows you to update how the repo is checked out
|
|
||||||
checkout_options: '-q --force -b'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
@@ -44,10 +44,6 @@ inputs:
|
|||||||
description: Push options (eg. --force)
|
description: Push options (eg. --force)
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
checkout_options:
|
|
||||||
description: Checkout options (eg. --branch)
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
skip_dirty_check:
|
skip_dirty_check:
|
||||||
description: Skip the check if the git repository is dirty and always try to create a commit.
|
description: Skip the check if the git repository is dirty and always try to create a commit.
|
||||||
required: false
|
required: false
|
||||||
|
@@ -43,11 +43,8 @@ _switch_to_branch() {
|
|||||||
# Fetch remote to make sure that repo can be switched to the right branch.
|
# Fetch remote to make sure that repo can be switched to the right branch.
|
||||||
git fetch;
|
git fetch;
|
||||||
|
|
||||||
# shellcheck disable=SC2206
|
|
||||||
INPUT_CHECKOUT_OPTIONS_ARRAY=( $INPUT_CHECKOUT_OPTIONS );
|
|
||||||
|
|
||||||
# Switch to branch from current Workflow run
|
# Switch to branch from current Workflow run
|
||||||
git checkout ${INPUT_CHECKOUT_OPTIONS:+"${INPUT_CHECKOUT_OPTIONS_ARRAY[@]}"} "$INPUT_BRANCH" --;
|
git checkout "$INPUT_BRANCH" --;
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_files() {
|
_add_files() {
|
||||||
|
@@ -32,7 +32,6 @@ setup() {
|
|||||||
export INPUT_COMMIT_AUTHOR="Test Suite <test@users.noreply.github.com>"
|
export INPUT_COMMIT_AUTHOR="Test Suite <test@users.noreply.github.com>"
|
||||||
export INPUT_TAGGING_MESSAGE=""
|
export INPUT_TAGGING_MESSAGE=""
|
||||||
export INPUT_PUSH_OPTIONS=""
|
export INPUT_PUSH_OPTIONS=""
|
||||||
export INPUT_CHECKOUT_OPTIONS=""
|
|
||||||
export INPUT_SKIP_DIRTY_CHECK=false
|
export INPUT_SKIP_DIRTY_CHECK=false
|
||||||
|
|
||||||
skipIfNot "$BATS_TEST_DESCRIPTION"
|
skipIfNot "$BATS_TEST_DESCRIPTION"
|
||||||
@@ -309,39 +308,6 @@ main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "git-checkout-options-are-applied" {
|
|
||||||
|
|
||||||
INPUT_CHECKOUT_OPTIONS="-b --progress"
|
|
||||||
|
|
||||||
touch "${test_repository}"/new-file-{1,2,3}.txt
|
|
||||||
|
|
||||||
shellmock_expect git --type partial --output " M new-file-1.txt M new-file-2.txt M new-file-3.txt" --match "status"
|
|
||||||
shellmock_expect git --type exact --match "fetch"
|
|
||||||
shellmock_expect git --type exact --match "checkout -b --progress master --"
|
|
||||||
shellmock_expect git --type partial --match "add ."
|
|
||||||
shellmock_expect git --type partial --match '-c'
|
|
||||||
shellmock_expect git --type partial --match 'push --set-upstream origin'
|
|
||||||
|
|
||||||
run main
|
|
||||||
|
|
||||||
echo "$output"
|
|
||||||
|
|
||||||
# Success Exit Code
|
|
||||||
[ "$status" = 0 ]
|
|
||||||
|
|
||||||
[ "${lines[10]}" = "::debug::Push commit to remote branch master" ]
|
|
||||||
|
|
||||||
|
|
||||||
shellmock_verify
|
|
||||||
[ "${capture[0]}" = "git-stub status -s -- ." ]
|
|
||||||
[ "${capture[1]}" = "git-stub fetch" ]
|
|
||||||
[ "${capture[2]}" = "git-stub checkout -b --progress master --" ]
|
|
||||||
[ "${capture[3]}" = "git-stub add ." ]
|
|
||||||
[ "${capture[4]}" = "git-stub -c user.name=Test Suite -c user.email=test@github.com commit -m Commit Message --author=Test Suite <test@users.noreply.github.com>" ]
|
|
||||||
[ "${capture[5]}" = "git-stub push --set-upstream origin HEAD:master --tags" ]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "can-checkout-different-branch" {
|
@test "can-checkout-different-branch" {
|
||||||
|
|
||||||
INPUT_BRANCH="foo"
|
INPUT_BRANCH="foo"
|
||||||
|
Reference in New Issue
Block a user