mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-07-31 15:26:10 +08:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bbd291750d | ||
|
114a5e6044 | ||
|
4a75a2e723 | ||
|
1e826be61c | ||
|
4bab898d25 | ||
|
45872c3c23 | ||
|
9b7c21583c | ||
|
4cc90c7784 | ||
|
367938329d | ||
|
25cac34d8d | ||
|
30cd17bff0 | ||
|
8f5b58c89c | ||
|
65928d2898 | ||
|
6b4ef1444c | ||
|
55291ea168 | ||
|
2b5c86365b | ||
|
ff28943460 | ||
|
e3610414be | ||
|
042c3265d5 | ||
|
90cedba8bc | ||
|
b833fe0e9d | ||
|
653ea719ea | ||
|
47c724214a | ||
|
1ba48c6d7f | ||
|
b9e4cea0ef | ||
|
cfdb7e609e | ||
|
849613a3ad | ||
|
0ee9fb7263 | ||
|
6456430b6b | ||
|
7f67b0b49b | ||
|
8700c3bc1c | ||
|
872d72f1ae | ||
|
f905f00706 | ||
|
9c1e5d1c6a | ||
|
18a94e4f78 | ||
|
44aeb24da7 |
31
.github/workflows/integration-tests.yml
vendored
Normal file
31
.github/workflows/integration-tests.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Integration Tests
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test-commit-works:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Create Remote Branch
|
||||
run: |
|
||||
git checkout -b ci-test
|
||||
git push origin ci-test
|
||||
git checkout 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
|
||||
|
||||
- name: Delete Branch
|
||||
run: git push -d origin ci-test
|
1
.github/workflows/linter.yml
vendored
1
.github/workflows/linter.yml
vendored
@@ -14,5 +14,6 @@ jobs:
|
||||
uses: github/super-linter@v3
|
||||
env:
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
VALIDATE_MARKDOWN: false
|
||||
DEFAULT_BRANCH: master
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
25
CHANGELOG.md
25
CHANGELOG.md
@@ -4,15 +4,34 @@ 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.6.0...HEAD)
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.2...HEAD)
|
||||
|
||||
> TBD
|
||||
|
||||
|
||||
## [v4.7.2](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.1...v4.7.2) - 2020-10-24
|
||||
|
||||
This release basically reverts the Action to the state of `v4.6.0`.
|
||||
|
||||
### Changed
|
||||
- Revert change to fix git-checkout with special characters in branch names [#122](https://github.com/stefanzweifel/git-auto-commit-action/pull/122)
|
||||
|
||||
|
||||
## [v4.7.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.7.0...v4.7.1) - 2020-10-22
|
||||
|
||||
### 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-21
|
||||
|
||||
### Added
|
||||
- Add `checkout_options` [#115](https://github.com/stefanzweifel/git-auto-commit-action/pull/115)
|
||||
|
||||
|
||||
## [v4.6.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.5.1...v4.6.0) - 2020-10-11
|
||||
|
||||
### Changes
|
||||
|
||||
### Changed
|
||||
- Make "commit_message" optional and set default commit message to "Apply automatic changes" [#103](https://github.com/stefanzweifel/git-auto-commit-action/issues/103), [#110](https://github.com/stefanzweifel/git-auto-commit-action/pull/110)
|
||||
|
||||
### Fixes
|
||||
|
16
README.md
16
README.md
@@ -5,6 +5,9 @@
|
||||
<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="">
|
||||
</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.
|
||||
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>".
|
||||
@@ -146,6 +149,11 @@ If you work in an organization and don't want to create a PAT from your personal
|
||||
|
||||
### Using the Action in forks from public repositories
|
||||
|
||||
**☝️ Important Notice**: 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.\
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
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.)
|
||||
|
||||
If you want that a Workflow using this Action runs on Pull Requests opened by forks, 2 things have to be changed:
|
||||
@@ -165,15 +173,13 @@ The following workflow runs `php-cs-fixer` (a code linter and fixer for PHP) whe
|
||||
```yaml
|
||||
name: Format PHP
|
||||
|
||||
on: [pull_request, pull_request_target]
|
||||
on: [push, pull_request, pull_request_target]
|
||||
|
||||
jobs:
|
||||
php-cs-fixer:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
@@ -190,7 +196,7 @@ Here's how the Pull Request will look like:
|
||||

|
||||
|
||||
|
||||
As you can see, your contributors have to go through hoops to make this work. For Workflows which runter linters and fixers (like the example above) we recommend running them when a push happens on the `master`-branch.
|
||||
As you can see, your contributors have to go through hoops to make this work. **For Workflows which runter linters and fixers (like the example above) we recommend running them when a push happens on the `master`-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/).
|
||||
@@ -254,7 +260,7 @@ This is due to limitations set up by GitHub, [commits of this Action do not trig
|
||||
The package has tests written in [bats](https://github.com/bats-core/bats-core). You can run them with the following command.
|
||||
|
||||
```shell
|
||||
npm run tests
|
||||
npm run test
|
||||
```
|
||||
|
||||
## Versioning
|
||||
|
@@ -29,10 +29,11 @@ _main() {
|
||||
|
||||
_switch_to_repository() {
|
||||
echo "INPUT_REPOSITORY value: $INPUT_REPOSITORY";
|
||||
cd $INPUT_REPOSITORY;
|
||||
cd "$INPUT_REPOSITORY";
|
||||
}
|
||||
|
||||
_git_is_dirty() {
|
||||
# shellcheck disable=SC2086
|
||||
[ -n "$(git status -s -- $INPUT_FILE_PATTERN)" ]
|
||||
}
|
||||
|
||||
@@ -43,11 +44,14 @@ _switch_to_branch() {
|
||||
git fetch;
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
# shellcheck disable=SC2086
|
||||
git checkout $INPUT_BRANCH;
|
||||
}
|
||||
|
||||
_add_files() {
|
||||
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}";
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git add ${INPUT_FILE_PATTERN};
|
||||
}
|
||||
|
||||
@@ -55,6 +59,7 @@ _local_commit() {
|
||||
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}";
|
||||
echo "::debug::Apply commit options ${INPUT_COMMIT_OPTIONS}";
|
||||
|
||||
# shellcheck disable=SC2206
|
||||
INPUT_COMMIT_OPTIONS_ARRAY=( $INPUT_COMMIT_OPTIONS );
|
||||
|
||||
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" \
|
||||
@@ -80,6 +85,7 @@ _push_to_github() {
|
||||
echo "INPUT_PUSH_OPTIONS: ${INPUT_PUSH_OPTIONS}";
|
||||
echo "::debug::Apply push options ${INPUT_PUSH_OPTIONS}";
|
||||
|
||||
# shellcheck disable=SC2206
|
||||
INPUT_PUSH_OPTIONS_ARRAY=( $INPUT_PUSH_OPTIONS );
|
||||
|
||||
if [ -z "$INPUT_BRANCH" ]
|
||||
|
@@ -3,6 +3,6 @@
|
||||
|
||||
|
||||
bats@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/bats/-/bats-1.1.0.tgz#6fc44f283ed4e7af2b6ffac93ec5026a1acbdc66"
|
||||
integrity sha512-1pA29OhDByrUtAXX+nmqZxgRgx2y8PvuZzbLJVjd2dpEDVDvz0MjcBMdmIPNq5lC+tG53G+RbeRsbIlv3vw7tg==
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/bats/-/bats-1.2.1.tgz#c15aecc3eb331aedf28678880fab2be0b73eba43"
|
||||
integrity sha512-2fcPDRQa/Kvh6j1IcCqsHpT5b9ObMzRzw6abC7Bg298PX8Qdh9VRkvO2WJUEhdyfjq2rLBCOAWdcv0tS4+xTUA==
|
||||
|
Reference in New Issue
Block a user