Compare commits

...

180 Commits

Author SHA1 Message Date
Stefan Zweifel
c180c695f2 Release v4.2.0 2020-05-10 13:16:25 +02:00
Stefan Zweifel
c1a70c9013 Update Changelog 2020-05-10 13:12:24 +02:00
Stefan Zweifel
02c4f2cf78 Merge pull request #73 from spawnia/restructure-readme
Bundle limitations and gotchas together in the README.md
2020-05-10 13:11:32 +02:00
Stefan Zweifel
3c687aa8ba Replace head_ref with branch name example 2020-05-10 13:09:18 +02:00
spawnia
a69eabaead clarify branch option 2020-05-10 12:55:07 +02:00
spawnia
9f2c45c9eb Remove unneeded hints to re-specify the default branch 2020-05-10 12:51:21 +02:00
spawnia
5bf88dc2fd Merge branch 'master' into restructure-readme 2020-05-10 12:48:11 +02:00
Stefan Zweifel
fd2aab7c5b Merge pull request #75 from stefanzweifel/use-head-ref-as-default-value
Use github.head_ref as branch default value
2020-05-10 12:31:26 +02:00
Stefan Zweifel
f342c95aa2 Use github.head_ref as branch default value 2020-05-09 12:44:07 +02:00
Benedikt Franke
1157d7bbe9 Shorten 2020-05-06 00:22:05 +02:00
Benedikt Franke
58b79711d8 Add example 2020-05-06 00:21:35 +02:00
Benedikt Franke
f5f76eb1f4 Consolidate more 2020-05-06 00:00:33 +02:00
Benedikt Franke
5513d18f64 Bundle limitations and gotchas together in the README.md 2020-05-05 23:54:32 +02:00
Stefan Zweifel
6ef5688e81 Update bug_report.md 2020-05-01 12:56:39 +02:00
Stefan Zweifel
e02ededdeb Update README with instructions and limitations
Closes #69
2020-05-01 12:56:23 +02:00
Stefan Zweifel
2f5e73df85 Release v4.1.6 2020-04-28 13:28:19 +02:00
Stefan Zweifel
cc16347545 Merge pull request #68 from stefanzweifel/fix-67
Inline User Configuration when creating a Tag
2020-04-28 13:27:03 +02:00
Stefan Zweifel
1ee136f439 Inline user config with tag command 2020-04-28 13:12:43 +02:00
Stefan Zweifel
7fdc480651 Update README.md 2020-04-24 10:14:37 +02:00
Stefan Zweifel
394681d465 Release v4.1.5 2020-04-23 20:46:50 +02:00
Stefan Zweifel
a261484cc8 Update file_pattern Example in README 2020-04-23 20:46:41 +02:00
Stefan Zweifel
43ed630979 Merge pull request #64 from stefanzweifel/fix-61
Fix Issue with Commit Options
2020-04-23 20:35:56 +02:00
Stefan Zweifel
ee9d717e46 Merge branch 'master' into fix-61
# Conflicts:
#	entrypoint.sh
2020-04-23 20:20:10 +02:00
Stefan Zweifel
68b94ecdf3 Merge pull request #65 from cristianpb/master
 Allow to add multiple files
2020-04-23 16:20:11 +02:00
cristianpb
2b0a9bca02 Allow to add multiple files 2020-04-23 15:55:10 +02:00
Stefan Zweifel
13c9c82cae Merge pull request #63 from stefanzweifel/revert-62-revert-59-no-override-global-git
Revert "Revert "Place git user configuration inline before commit""
2020-04-22 21:20:00 +02:00
Stefan Zweifel
6e0a745133 Use Array 2020-04-22 21:17:10 +02:00
Stefan Zweifel
88ddd5fba5 WIP 2020-04-22 21:04:17 +02:00
Stefan Zweifel
2dec151b5c WIP 2020-04-22 20:49:36 +02:00
Stefan Zweifel
1ba0b8765f WIP 2020-04-22 20:43:52 +02:00
Stefan Zweifel
f278d451d8 Revert hard coded options 2020-04-22 20:39:17 +02:00
Stefan Zweifel
1f6bf5e4c0 Set default value for commit_options 2020-04-22 20:39:08 +02:00
Stefan Zweifel
5dae7dbdb7 Hard Code Options 2020-04-22 20:36:26 +02:00
Stefan Zweifel
fbbf9665a8 Output git version and debugging message 2020-04-22 20:21:08 +02:00
Stefan Zweifel
e8ab63a01b Add ; in more places 2020-04-22 20:17:05 +02:00
Stefan Zweifel
fdbf836519 Split git-commit command 2020-04-22 20:07:31 +02:00
Stefan Zweifel
8f94f9b7ec Revert "Revert "Place git user configuration inline before commit"" 2020-04-22 20:04:52 +02:00
Stefan Zweifel
e6db1ef8bd Release v4.1.4 2020-04-22 12:58:51 +02:00
Stefan Zweifel
d09082150e Merge pull request #62 from stefanzweifel/revert-59-no-override-global-git
Revert "Place git user configuration inline before commit"
2020-04-22 12:56:36 +02:00
Stefan Zweifel
3e578b5696 Revert "Place git user configuration inline before commit" 2020-04-22 12:55:25 +02:00
Stefan Zweifel
c586963a3d Update README 2020-04-18 10:55:30 +02:00
Stefan Zweifel
a7342eab13 Release v4.1.3 2020-04-18 10:55:26 +02:00
Stefan Zweifel
256f31683d Add some Debug Logs 2020-04-18 10:53:20 +02:00
Stefan Zweifel
8040ba33d6 Merge pull request #59 from parndt/no-override-global-git
Place git user configuration inline before commit
2020-04-10 14:50:57 +02:00
Philip Arndt
80c7ed953f Place git user configuration inline 2020-04-10 11:38:03 +12:00
Stefan Zweifel
dd055f6225 Release v4.1.2 2020-04-03 09:19:39 +02:00
Stefan Zweifel
55734408b7 Merge pull request #57 from wxt2005/master
Remove unnecessary escape
2020-04-03 09:10:34 +02:00
Botao
d317154f77 Remove unnecessary escape 2020-04-03 13:21:53 +08:00
Stefan Zweifel
36489f4cb5 Merge pull request #56 from localheinz/patch-1
Fix: Typo
2020-03-17 15:44:10 +01:00
Andreas Möller
2530046e72 Fix: Typo 2020-03-17 13:44:47 +01:00
Stefan Zweifel
172c2a2fc3 Update CD Workflow 2020-03-14 13:39:33 +01:00
Stefan Zweifel
480e111bf8 Release v4.1.1 2020-03-14 13:37:49 +01:00
Stefan Zweifel
7659782c71 Merge pull request #54 from stefanzweifel/hotfix/optional-branch-push
Fix: Push branch to repository if no branch name is given and no tagging message is set
2020-03-14 13:34:39 +01:00
Stefan Zweifel
026f88c27c Fix typo in message 2020-03-14 13:32:10 +01:00
Stefan Zweifel
f73d11d461 Revert changes 2020-03-14 13:21:42 +01:00
Stefan Zweifel
2b6b90e8f1 Test shorthand 2020-03-14 13:20:32 +01:00
Stefan Zweifel
e1770ec52b Only add --tags option if tagging message is set 2020-03-14 13:13:34 +01:00
Stefan Zweifel
0453bb1c25 Temp disable push of tags 2020-03-14 13:11:13 +01:00
Stefan Zweifel
da55e4a0cf Add echo statements for easier debugging 2020-03-14 13:09:53 +01:00
Stefan Zweifel
b1833bd054 Merge pull request #52 from localheinz/fix/typo
Fix: Typo
2020-03-13 17:02:58 +01:00
Andreas Möller
6dfda22dd6 Fix: Typo 2020-03-13 12:35:11 +01:00
Stefan Zweifel
94c72aa7c5 Update Changelog and Readme for v4.1.0 2020-03-05 20:55:10 +01:00
Stefan Zweifel
87526a8aa1 Merge pull request #50 from stefanzweifel/feature/tag-commit
Feature: Tag commit created by the Action
2020-03-05 20:52:29 +01:00
Stefan Zweifel
844c808726 Echo out the tagging message 2020-03-05 20:48:15 +01:00
Stefan Zweifel
ce08dda6b3 Update Wording 2020-03-05 20:48:00 +01:00
Stefan Zweifel
0ad4c8ce73 Fix _tag_commit 2020-03-05 20:35:32 +01:00
Stefan Zweifel
3387b2f267 Add tagging_message input option 2020-03-05 20:31:06 +01:00
Stefan Zweifel
d4a53f1779 Push Tags to Remote Repository 2020-03-05 20:28:38 +01:00
Stefan Zweifel
956a47433b Merge pull request #49 from stefanzweifel/feature/outputs
Feature: Add "changes_detected" output
2020-03-04 20:44:32 +01:00
Stefan Zweifel
f866b2a854 Update Changelog 2020-03-04 20:33:53 +01:00
Stefan Zweifel
8744cc88ef Update README 2020-03-04 20:33:10 +01:00
Stefan Zweifel
57bbd38e56 Add outputs to action.yml 2020-03-04 19:56:33 +01:00
Stefan Zweifel
eef5f33ea3 WIP 2020-03-03 21:04:57 +01:00
Stefan Zweifel
25e6f0b17d Echo changes_detected in workflow 2020-03-03 21:00:40 +01:00
Stefan Zweifel
ae885f5d8c WIP 2020-03-03 20:54:12 +01:00
Stefan Zweifel
33e8fd937f Add changes_detected output 2020-03-03 20:51:12 +01:00
Stefan Zweifel
404d2015f4 Add Workflow to run git-auto-commit 2020-03-03 20:51:02 +01:00
Stefan Zweifel
cd0530ad7a Merge pull request #48 from clxmstaab/patch-1
example: fix typo
2020-03-03 12:12:50 +01:00
Markus Staab
2a957f5c41 example: fix typo 2020-03-03 12:08:03 +01:00
Stefan Zweifel
7e64e614a1 Fix Typo in README 2020-02-29 09:52:12 +01:00
Stefan Zweifel
c887fa4a07 Update Changelog 2020-02-24 20:09:19 +01:00
Stefan Zweifel
09d175379e Release v4.0.0 2020-02-24 20:03:49 +01:00
Stefan Zweifel
cdb861eda0 Merge pull request #45 from stefanzweifel/refactor/switch-to-js
[4.0] Switch to NodeJS Environment (BC)
2020-02-24 19:49:08 +01:00
Stefan Zweifel
6a853b60cc Add Continuous Deployment Workflow 2020-02-24 19:39:11 +01:00
Stefan Zweifel
76f50fc3ad Add PAT Example 2020-02-23 11:42:57 +01:00
Stefan Zweifel
9b4acb8f10 Update README 2020-02-23 11:29:03 +01:00
Stefan Zweifel
d11ccd183d Add commetn to index.js
I don't have so much experience in writing node-js scripts. It makes sense, to point out where most of the code in index.js is coming from.
2020-02-23 10:45:28 +01:00
Stefan Zweifel
a156a1072e Remove not required code 2020-02-23 10:44:44 +01:00
Stefan Zweifel
d69e5f0850 WIP 2020-02-23 10:16:26 +01:00
Stefan Zweifel
86f0c11c06 Remove dist/index.js 2020-02-11 21:08:14 +01:00
Stefan Zweifel
eda98fb9e5 Simplify index.js 2020-02-11 21:04:18 +01:00
Stefan Zweifel
844e852dde Add @actions/exec 2020-02-11 21:00:40 +01:00
Stefan Zweifel
cca75e0840 Add compiled index.js file 2020-02-11 20:54:10 +01:00
Stefan Zweifel
ef107e1d4b Switch Action to use node12 2020-02-11 20:50:33 +01:00
Stefan Zweifel
e97d20ce65 Add package.json and other JavaScript related files 2020-02-11 20:50:22 +01:00
Stefan Zweifel
3c9d7dd29d Remove Dockerfile 2020-02-11 20:47:37 +01:00
Stefan Zweifel
4ff392a586 Merge pull request #42 from zhangyoufu/patch-1
fix typo in README.md
2020-02-08 07:50:13 +01:00
Youfu Zhang
69c53bd75e fix typo in README.md 2020-02-08 12:28:25 +08:00
Stefan Zweifel
8563bc2c47 Tag v3.0.0 2020-02-06 21:15:35 +01:00
Stefan Zweifel
657dcb0873 Merge pull request #40 from stefanzweifel/v3
Release: v3.0.0
2020-02-06 21:14:31 +01:00
Stefan Zweifel
1d39bb676c Merge pull request #41 from stefanzweifel/feature/make-branch-optional
Make branch option optional
2020-02-06 20:51:13 +01:00
Stefan Zweifel
864c975b87 Update README 2020-02-06 20:49:03 +01:00
Stefan Zweifel
33592697c4 Update Changelog 2020-02-06 20:43:04 +01:00
Stefan Zweifel
13e281008a Update entrypoint.sh 2020-02-06 17:51:55 +01:00
Stefan Zweifel
42e5be9ebb WIP 2020-02-05 21:39:14 +01:00
Stefan Zweifel
f0354eba45 WIP 2020-02-05 21:36:48 +01:00
Stefan Zweifel
af7b14b2cf WIP 2020-02-05 21:32:57 +01:00
Stefan Zweifel
5a4e81ccd7 WIP 2020-02-05 21:31:46 +01:00
Stefan Zweifel
0884c39e7e WIP 2020-02-05 21:28:18 +01:00
Stefan Zweifel
5ab45a4eef WIP 2020-02-05 21:26:30 +01:00
Stefan Zweifel
e20b39e8ed Remove branch default value 2020-02-05 21:24:36 +01:00
Stefan Zweifel
5df30c89b8 Update how commit is pushed 2020-02-05 21:22:54 +01:00
Stefan Zweifel
b197c5ff8c Set default value for branch 2020-02-05 21:12:20 +01:00
Stefan Zweifel
098f1a8051 Merge pull request #39 from stefanzweifel/feature/commiter-options
Add Options to change Commit User Name and Email and Author
2020-02-05 20:38:20 +01:00
Stefan Zweifel
a06032e34f Update Changelog 2020-02-05 20:36:12 +01:00
Stefan Zweifel
3185f2bd2a Update README 2020-02-05 20:27:14 +01:00
Stefan Zweifel
5432544bdb Update Docs 2020-02-05 20:24:25 +01:00
Stefan Zweifel
0a5fd7e510 Merge branch 'v3' into feature/commiter-options
# Conflicts:
#	README.md
#	entrypoint.sh
2020-02-05 20:12:29 +01:00
Stefan Zweifel
81fa501ea5 Merge pull request #36 from stefanzweifel/refactor/remove-git-setup
Remove need for GITHUB_TOKEN
2020-02-05 19:52:36 +01:00
Stefan Zweifel
3c60dc19b2 Update README 2020-02-04 21:27:15 +01:00
Stefan Zweifel
0822a9b930 Add commit_author input option 2020-02-04 21:02:40 +01:00
Stefan Zweifel
d47024e59c Add commit_user_name and commit_user_email inputs 2020-02-04 20:14:27 +01:00
Stefan Zweifel
ae384f95d0 Update Changelog 2020-02-04 19:43:08 +01:00
Stefan Zweifel
959e7d4eab Update README 2020-02-04 19:42:37 +01:00
Stefan Zweifel
b21b1abc6d Update Comment 2020-02-04 19:37:58 +01:00
Stefan Zweifel
35440b9386 Update README 2020-02-04 19:37:00 +01:00
Stefan Zweifel
99f6ce74b4 Update README.md 2020-01-14 14:44:34 +01:00
Stefan Zweifel
4ab94c0ec4 Remove creation of .netrc file 2020-01-13 21:23:03 +01:00
Stefan Zweifel
1a9ba81dae Merge pull request #32 from yelizariev/patch-2
delete args as not used
2020-01-11 21:40:52 +01:00
Stefan Zweifel
2043118160 Update Dockerfile 2020-01-11 21:35:29 +01:00
Stefan Zweifel
9879efa581 Merge pull request #34 from yelizariev/refactoring
refactoring: combine merge lib.sh to entrypoint.sh
2020-01-11 21:34:15 +01:00
Stefan Zweifel
3525430c70 Update README 2020-01-11 21:32:17 +01:00
Stefan Zweifel
db25cb8fde Add checkout@v2 example
Closes #33
2020-01-11 21:32:11 +01:00
Ivan Yelizariev
5dd90bb58c refactoring: combine merge lib.sh to entrypoint.sh
If we use "source /lib.sh", bash will point to wrong line in case of an error.
It's confusing on debuggin new features
2020-01-10 13:08:35 +05:00
Ivan Yelizariev
36610a4da0 delete args as not used
closes #31
2020-01-07 12:27:14 +05:00
Stefan Zweifel
26a56d2023 Add note to README about forks and PRs 2020-01-04 17:54:44 +01:00
Stefan Zweifel
6d7a33192e Release v2.5.0 2019-12-18 11:59:49 +01:00
Stefan Zweifel
d625ec8b28 Update Description of inputs 2019-12-18 11:58:17 +01:00
Stefan Zweifel
e870f94840 Update Changelog 2019-12-18 11:57:16 +01:00
Stefan Zweifel
4a6ffd0603 Merge pull request #24 from stefanzweifel/extract-logic-to-lib
Extract methods into lib.sh / Add shellcheck workflow
2019-12-16 14:57:24 +01:00
Stefan Zweifel
dcfe3115ff WIP 2019-12-12 21:40:03 +01:00
Stefan Zweifel
3f6e990b1e Update lib.sh 2019-12-12 21:14:38 +01:00
Stefan Zweifel
560cf49647 Update Workflow 2019-12-12 21:10:29 +01:00
Stefan Zweifel
c62363dd62 Add Workflow to run Shellcheck 2019-12-12 21:05:01 +01:00
Stefan Zweifel
7c85ce3dee Update path to lib.sh 2019-12-12 20:46:16 +01:00
Stefan Zweifel
8bb153baaa Update Dockerfile 2019-12-12 20:45:42 +01:00
Stefan Zweifel
68035425ff Update Path 2019-12-12 20:44:41 +01:00
Stefan Zweifel
3273c330f8 Fix path 2019-12-12 20:42:47 +01:00
Stefan Zweifel
4280601118 Create lib.sh and update entrypoint.sh 2019-12-12 20:41:00 +01:00
Stefan Zweifel
3c148f8a94 Merge pull request #22 from yelizariev/custom-repo-path
Add "repository" option for custom repository path
2019-12-10 20:20:25 +01:00
Ivan Yelizariev
d3ceacae7d Add "repository" option for custom repository path 2019-12-10 17:20:25 +05:00
Stefan Zweifel
d338d7dd00 Update README to latest version 2019-11-30 19:42:53 +01:00
Stefan Zweifel
f7e2c0f118 Release v2.4.0 2019-11-30 19:40:57 +01:00
Stefan Zweifel
8db04fa14f Merge pull request #21 from jkaan/feature/add-support-for-lfs
Install Git-LFS while building Dockerfile
2019-11-30 19:37:41 +01:00
Joey Kaan
44a415d3cb Install Git-LFS while building Dockerfile 2019-11-30 13:05:28 +01:00
Stefan Zweifel
af9e1689a5 Update Changelog 2019-11-27 20:07:24 +01:00
Stefan Zweifel
2b22ba6212 Merge pull request #19 from localheinz/fix/untracked
Fix: Use 'git status -s' to check for untracked/modified files
2019-11-27 20:03:09 +01:00
Andreas Möller
b1b8ae8b5c Fix: Use 'git status -s' to check for untracked/modified files 2019-11-27 11:24:27 +01:00
Stefan Zweifel
fb3de05451 Revert "Fix: Add files that are not tracked yet"
This reverts commit 65d8bdf167.
2019-11-24 12:21:42 +01:00
Stefan Zweifel
284d0b78f0 Fix: Add files that are not tracked yet (#17)
Fix: Add files that are not tracked yet
2019-11-22 13:00:18 +01:00
Stefan Zweifel
188fc2bd58 Delete foo 2019-11-22 12:59:27 +01:00
Andreas Möller
65d8bdf167 Fix: Add files that are not tracked yet 2019-11-22 11:55:58 +01:00
Stefan Zweifel
40255153c4 Fix Link in README 2019-11-04 20:09:04 +01:00
Stefan Zweifel
0ef5bf58dc Tag v2.3.0 2019-11-04 20:07:50 +01:00
Stefan Zweifel
e924b16154 Merge pull request #15 from gomorizsolt/issue-14_support-custom-git-params
Support custom git params.
Fixes #14
2019-11-04 20:04:09 +01:00
Gömöri Zsolt
2fb839c669 Remove is_defined() 2019-11-01 11:11:19 +01:00
Gömöri Zsolt
908446c002 Use :+ to avoid empty string 2019-11-01 11:03:23 +01:00
Gömöri Zsolt
2d23a29775 Use one-line if statement 2019-11-01 10:53:56 +01:00
Gömöri Zsolt
bdc88aff2c Re-add is_defined() to eliminate empty string in git commit 2019-11-01 10:44:09 +01:00
Gömöri Zsolt
ddcd35eaa8 Remove is_defined() approach 2019-11-01 10:19:20 +01:00
Gömöri Zsolt
760c9be2dc Define default value for file_pattern 2019-11-01 10:15:22 +01:00
Gömöri Zsolt
69d0349561 Log input params beforehand 2019-11-01 10:10:52 +01:00
Gömöri Zsolt
eecee2898e Follow GH Action's naming restrictions 2019-11-01 10:04:42 +01:00
Gömöri Zsolt
3889fd6a6c Add args entry to actions.yml 2019-11-01 09:51:54 +01:00
Gömöri Zsolt
1ad5315ba7 Fix log statement 2019-11-01 09:51:19 +01:00
gomorizsolt
fa043bd474 Remove junk code 2019-10-31 15:13:27 +01:00
gomorizsolt
af33cfbb5c Replace get_value with is_defined altogether 2019-10-31 14:49:38 +01:00
gomorizsolt
677efa2969 Remove blank line 2019-10-31 11:25:08 +01:00
gomorizsolt
b6dcf94303 Add is_defined and get_value to improve on code's reusability 2019-10-31 11:18:48 +01:00
gomorizsolt
a65a3a47cd Support commit options, update README.md accordingly 2019-10-31 09:02:56 +01:00
11 changed files with 431 additions and 104 deletions

View File

@@ -7,8 +7,10 @@ assignees: ''
---
<!-- Before opening an issue, have you tried solving your problem by explicitly setting the `branch`-value in your workflow? -->
**Version of the Action**
`v2.x.x`
`v4.x.x`
**Describe the bug**
A clear and concise description of what the bug is.
@@ -26,5 +28,11 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Used Workflow**
```yaml
# Paste the Workflow you've used here
```
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,31 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Continuous Deployment"
on:
push:
tags:
- "**"
jobs:
release:
name: "Release"
runs-on: "ubuntu-latest"
steps:
- name: "Determine tag"
id: "determine-tag"
run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\""
- name: "Create release"
uses: "actions/create-release@v1.0.0"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
draft: false
prerelease: false
body: |
See [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) for details.
release_name: "${{ steps.determine-tag.outputs.tag }}"
tag_name: "${{ steps.determine-tag.outputs.tag }}"

22
.github/workflows/git-auto-commit.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: git-auto-commit
on: push
jobs:
git-auto-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use git-auto-commit-action
id: "auto-commit-action"
uses: ./
- name: "no changes detected"
if: steps.auto-commit-action.outputs.changes_detected == false
run: "echo \"No changes detected\""
- name: "changes detected"
if: steps.auto-commit-action.outputs.changes_detected == true
run: "echo \"Changes detected\""

12
.github/workflows/shellcheck.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Shellcheck
on: push
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: shellcheck
uses: ludeeus/action-shellcheck@0.1.0

View File

@@ -4,13 +4,107 @@ 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/v2.2.0...HEAD)
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.2.0...HEAD)
> TBD
## [v4.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.6...v4.2.0) - 2020-05-10
### Changed
- Use `${{ github.head_ref }}` as default branch value. Therefore, the branch name when listening for `pull_request`-events is optional. [#75](https://github.com/stefanzweifel/git-auto-commit-action/pull/75), [#73](https://github.com/stefanzweifel/git-auto-commit-action/pull/73)
## [v4.1.6](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.5...v4.1.6) - 2020-04-28
### Fixes
- Fix issue where tags could not be created correctly [#68](https://github.com/stefanzweifel/git-auto-commit-action/pull/68)
## [v4.1.5](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.4...v4.1.5) - 2020-04-23
### Added
- Update `file_pattern` to support multiple file paths [#65](https://github.com/stefanzweifel/git-auto-commit-action/pull/65)
### Changes
- Revert changes made in v4.1.4 [#63](https://github.com/stefanzweifel/git-auto-commit-action/pull/63)
### Fixes
- Fix issue with `commit_options` [#64](https://github.com/stefanzweifel/git-auto-commit-action/pull/64)
## [v4.1.4](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.3...v4.1.4) - 2020-04-22
### Fixed
- Fix bug introduced in previous version, where git user configuration has been placed inline [#62](https://github.com/stefanzweifel/git-auto-commit-action/pull/62)
## [v4.1.3](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.2...v4.1.3) - 2020-04-18
### Changed
- Place Git user configuration inline [#59](https://github.com/stefanzweifel/git-auto-commit-action/pull/59)
## [v4.1.2](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.1...v4.1.2) - 2020-04-03
### Fixes
- Fix Issue with `changes_detected`-output [#57](https://github.com/stefanzweifel/git-auto-commit-action/pull/57)
## [v4.1.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.0...v4.1.1) - 2020-03-14
### Fixes
- Fix issue where commit has not been pushed to remote repository, when no `branch`-option has been given [#54](https://github.com/stefanzweifel/git-auto-commit-action/pull/54)
## [v4.1.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.0.0...v4.1.0) - 2020-03-05
### Added
- Add `changes_detected` output [#49](https://github.com/stefanzweifel/git-auto-commit-action/pull/49), [#46](https://github.com/stefanzweifel/git-auto-commit-action/issues/46)
- Add `tagging_message` input option to create and push tags [#50](https://github.com/stefanzweifel/git-auto-commit-action/pull/50), [#47](https://github.com/stefanzweifel/git-auto-commit-action/issues/47)
## [v4.0.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v3.0.0...v4.0.0) - 2020-02-24
### Changed
- Switch Action to use `node12`-environment instead of `docker`. [#45](https://github.com/stefanzweifel/git-auto-commit-action/pull/45)
## [v3.0.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.5.0...v3.0.0) - 2020-02-06
### Added
- Add `commit_user_name`, `commit_user_email` and `commit_author` input options for full customzation on how the commit is being created [#39](https://github.com/stefanzweifel/git-auto-commit-action/pull/39)
### Changed
- Make the `branch` input option optional [#41](https://github.com/stefanzweifel/git-auto-commit-action/pull/41)
### Removed
- Remove the need of a GITHUB_TOKEN. Users now have to use `actions/checkout@v2` or higher [#36](https://github.com/stefanzweifel/git-auto-commit-action/pull/36)
## [v2.5.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.4.0...v2.5.0) - 2019-12-18
### Added
- Add new `repository`-argument [#22](https://github.com/stefanzweifel/git-auto-commit-action/pull/22)
### Changed
- Extract logic of the Action into methods and into a separate file [#24](https://github.com/stefanzweifel/git-auto-commit-action/pull/24)
## [v2.4.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.3.0...v2.4.0) - 2019-11-30
### Added
- Commit untracked files [#19](https://github.com/stefanzweifel/git-auto-commit-action/pull/19) (fixes [#16](https://github.com/stefanzweifel/git-auto-commit-action/issues/16))
- Add support for Git-LFS [#21](https://github.com/stefanzweifel/git-auto-commit-action/pull/21) (fixes [#20](https://github.com/stefanzweifel/git-auto-commit-action/issues/20))
## [v2.3.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.2.0...v2.3.0) - 2019-11-04
### Added
- Add a new `commit_option`-argument. Allows users to define additional commit options for the `git-commit` command. [#14](https://github.com/stefanzweifel/git-auto-commit-action/pull/15)
## [v2.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.1.0...v2.2.0) - 2019-10-26
### Added
- Add new `file_pattern`-argument. Allows users to define which files should be added in the commit. [#13](https://github.com/stefanzweifel/git-auto-commit-action/pull/13)
## [v2.1.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.0.0...v2.1.0) - 2019-09-20
### Added

View File

@@ -1,14 +0,0 @@
FROM alpine/git:1.0.7
LABEL "com.github.actions.name"="Auto Commit changed files"
LABEL "com.github.actions.description"="Automatically commits files which have been changed during the workflow run and push changes back to remote repository."
LABEL "com.github.actions.icon"="git-commit"
LABEL "com.github.actions.color"="orange"
LABEL "repository"="http://github.com/stefanzweifel/git-auto-commit-action"
LABEL "homepage"="http://github.com/stefanzweifel/git-auto-commit-action"
LABEL "maintainer"="Stefan Zweifel <hello@stefanzweifel.io>"
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]

133
README.md
View File

@@ -1,77 +1,140 @@
# git-auto-commit-action
# git-auto-commit Action
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the Commit back to GitHub.
The Committer is "GitHub Actions <actions@github.com>" and the Author of the Commit is "Your GitHub Username <github_username@users.noreply.github.com>.
> The GitHub Action for committing files for the 80% use case.
If no changes are available, the Actions does nothing.
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>".
This Action has been inspired and adapted from the [auto-commit](https://github.com/cds-snc/github-actions/tree/master/auto-commit
)-Action of the Canadian Digital Service and the [commit](https://github.com/elstudio/actions-js-build/blob/41d604d6e73d632e22eac40df8cc69b5added04b/commit/entrypoint.sh)-Action by Eric Johnson.
)-Action of the Canadian Digital Service and this [commit](https://github.com/elstudio/actions-js-build/blob/41d604d6e73d632e22eac40df8cc69b5added04b/commit/entrypoint.sh)-Action by Eric Johnson.
## Usage
Add the following step at the end of your job.
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@v2.2.0
- uses: stefanzweifel/git-auto-commit-action@v4.2.0
with:
# Required
commit_message: Apply automatic changes
branch: ${{ github.head_ref }}
# Optional branch to push to, defaults to the current branch
branch: feature-123
# Optional git params
commit_options: '--no-verify --signoff'
# Optional glob pattern of files which should be added to the commit
file_pattern: src/\*.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
file_pattern: src/*.js tests/*.js
# Optional local file path to the repository
repository: .
# Optional commit user and author settings
commit_user_name: My GitHub Actions Bot
commit_user_email: my-github-actions-bot@example.org
commit_author: Author <actions@github.com>
# Optional tag message
# Action will create and push a new tag to the remote repository and the defined branch
tagging_message: 'v1.0.0'
```
You **do not** have to create a new secret called `GITHUB_TOKEN` in your repository. `GITHUB_TOKEN` is a special token GitHub creates automatically during an Action run. (See [the documentation](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for details)
## Example
The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!
It is recommended to use this Action in Workflows which listen to the `pull_request` event. If you want to use the Action on other events, you have to hardcode the value for `branch` as `github.head_ref` is only available in Pull Requests.
## Example Usage
This Action will only work, if the job in your workflow changes project files.
The most common use case for this, is when you're running a Linter or Code-Style fixer on GitHub Actions.
In this example I'm running `php-cs-fixer` in a PHP project.
In this example, we're running `php-cs-fixer` in a PHP project to fix the codestyle automatically, then commit possible changed files back to the repository.
Note that we explicitly specify `${{ github.head_ref }}` in the checkout Action.
This is required in order to work with the `pull_request` event (or any other non-`push` event).
```yaml
name: php-cs-fixer
on:
pull_request:
paths:
- '**.php'
push:
branches:
- "master"
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 1
ref: ${{ github.head_ref }}
- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga
- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v2.2.0
- uses: stefanzweifel/git-auto-commit-action@v4.2.0
with:
commit_message: Apply php-cs-fixer changes
branch: ${{ github.head_ref }}
file_pattern: src/\*.php
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Inputs
## Limitations & Gotchas
Checkout [`actions.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/actions.yml) for a full list of supported inputs.
### Checkout the correct branch
You must use `action/checkout@v2` or later versions to checkout the repository.
In non-`push` events, such as `pull_request`, make sure to specify the `ref` to checkout:
```yaml
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
```
You have to do this do avoid that the `checkout`-Action clones your repository in a detached state.
### Commits of this Action do not trigger new Workflow runs
The resulting commit **will not trigger** another GitHub Actions Workflow run.
This is due to [limititations set by GitHub](https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token).
> When you use the repository's GITHUB_TOKEN to perform tasks on behalf of the GitHub Actions app, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs.
You can change this by creating a new [Personal Access Token (PAT)](https://github.com/settings/tokens/new),
storing the token as a secret in your repository and then passing the new token to the [`actions/checkout`](https://github.com/actions/checkout#usage) Action.
```yaml
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_TOKEN }}
```
### Unable to commit into PRs from forks
GitHub currently prohibits Actions to push commits to forks, even when they created a PR and allow edits.
See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.
## Inputs
Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs.
## Outputs
You can use these outputs to trigger other Actions in your Workflow run based on the result of `git-auto-commit-action`.
- `changes_detected`: Returns either "true" or "false" if the repository was dirty and files have changed.
## Troubleshooting
### Action does not push commit to repository
Make sure to [checkout the correct branch](#checkout-the-correct-branch).
### Action does not push commit to repository: Authentication Issue
If your Workflow can't push the commit to the repository because of authentication issues,
please update your Workflow configuration and usage of [`actions/checkout`](https://github.com/actions/checkout#usage).
Updating the `token` value with a Personal Access Token should fix your issues.
### No new workflows are triggered by the commit of this action
This is due to limitations set up by GitHub, [commits of this Action do not trigger new Workflow runs](#commits-of-this-action-do-not-trigger-new-workflow-runs).
## Versioning

53
action.yml Normal file
View File

@@ -0,0 +1,53 @@
name: Git Auto Commit
description: 'Automatically commits files which have been changed during the workflow run and push changes back to remote repository.'
author: Stefan Zweifel <hello@stefanzweifel.io>
inputs:
commit_message:
description: Commit message
required: true
branch:
description: Git branch name, where changes should be pushed too. Required if Action is used on the `pull_request` event
required: false
default: ${{ github.head_ref }}
commit_options:
description: Commit options (eg. --no-verify)
required: false
default: ''
file_pattern:
description: File pattern used for `git add`. For example `src/\*.js`
required: false
default: '.'
repository:
description: Local file path to the git repository. Defaults to the current directory (`.`)
required: false
default: '.'
commit_user_name:
description: Name used for the commit user
required: false
default: GitHub Actions
commit_user_email:
description: Email address used for the commit user
required: false
default: actions@github.com
commit_author:
description: Value used for the commit author. Defaults to the username of whoever triggered this workflow run.
required: false
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
tagging_message:
description: Message used to create a new git tag with the commit. Keep this empty, if no tag should be created.
required: false
default: ''
outputs:
changes_detected:
description: Value is "true", if the repository was dirty and file changes have been detected. Value is "false", if no changes have been detected.
runs:
using: 'node12'
main: 'index.js'
branding:
icon: 'git-commit'
color: orange

View File

@@ -1,24 +0,0 @@
name: Git Auto Commit
description: 'Automatically commits files which have been changed during the workflow run and push changes back to remote repository.'
author: Stefan Zweifel <hello@stefanzweifel.io>
inputs:
commit_message:
description: Commit message
required: true
branch:
description: Branch where changes should be pushed too
required: true
file_pattern:
description: File pattern used for "git add"
required: false
default: '.'
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'git-commit'
color: orange

View File

@@ -1,46 +1,94 @@
#!/bin/sh
#!/bin/bash
set -eu
# Set up .netrc file with GitHub credentials
git_setup ( ) {
cat <<- EOF > $HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
_main() {
_switch_to_repository
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 $HOME/.netrc
if _git_is_dirty; then
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
echo "::set-output name=changes_detected::true";
_switch_to_branch
_add_files
_local_commit
_tag_commit
_push_to_github
else
echo "::set-output name=changes_detected::false";
echo "Working tree clean. Nothing to commit.";
fi
}
# This section only runs if there have been file changes
echo "Checking for uncommitted changes in the git working tree."
if ! git diff --quiet
then
git_setup
_switch_to_repository() {
echo "INPUT_REPOSITORY value: $INPUT_REPOSITORY";
cd $INPUT_REPOSITORY;
}
_git_is_dirty() {
[ -n "$(git status -s)" ]
}
_switch_to_branch() {
echo "INPUT_BRANCH value: $INPUT_BRANCH";
# Switch to branch from current Workflow run
git checkout $INPUT_BRANCH
git checkout $INPUT_BRANCH;
}
if [ -z ${INPUT_FILE_PATTERN+x} ];
_add_files() {
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}";
git add ${INPUT_FILE_PATTERN};
}
_local_commit() {
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}";
echo "::debug::Apply commit options ${INPUT_COMMIT_OPTIONS}";
INPUT_COMMIT_OPTIONS_ARRAY=( $INPUT_COMMIT_OPTIONS );
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" \
commit -m "$INPUT_COMMIT_MESSAGE" \
--author="$INPUT_COMMIT_AUTHOR" \
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};
}
_tag_commit() {
echo "INPUT_TAGGING_MESSAGE: ${INPUT_TAGGING_MESSAGE}"
if [ -n "$INPUT_TAGGING_MESSAGE" ]
then
git add .
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE";
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE";
else
echo "INPUT_FILE_PATTERN value: $INPUT_FILE_PATTERN";
git add $INPUT_FILE_PATTERN
echo " No tagging message supplied. No tag will be added.";
fi
}
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
_push_to_github() {
if [ -z "$INPUT_BRANCH" ]
then
# Only add `--tags` option, if `$INPUT_TAGGING_MESSAGE` is set
if [ -n "$INPUT_TAGGING_MESSAGE" ]
then
echo "::debug::git push origin --tags";
git push origin --tags;
else
echo "::debug::git push origin";
git push origin;
fi
git push --set-upstream origin "HEAD:$INPUT_BRANCH"
else
echo "Working tree clean. Nothing to commit."
fi
else
echo "::debug::Push commit to remote branch $INPUT_BRANCH";
git push --set-upstream origin "HEAD:$INPUT_BRANCH" --tags;
fi
}
_main

34
index.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* Most of this code has been copied from the following GitHub Action
* to make it simpler or not necessary to install a lot of
* JavaScript packages to execute a shell script.
*
* https://github.com/ad-m/github-push-action/blob/fe38f0a751bf9149f0270cc1fe20bf9156854365/start.js
*/
const spawn = require('child_process').spawn;
const path = require("path");
const exec = (cmd, args=[]) => new Promise((resolve, reject) => {
console.log(`Started: ${cmd} ${args.join(" ")}`)
const app = spawn(cmd, args, { stdio: 'inherit' });
app.on('close', code => {
if(code !== 0){
err = new Error(`Invalid status code: ${code}`);
err.code = code;
return reject(err);
};
return resolve(code);
});
app.on('error', reject);
});
const main = async () => {
await exec('bash', [path.join(__dirname, './entrypoint.sh')]);
};
main().catch(err => {
console.error(err);
console.error(err.stack);
process.exit(err.code || -1);
})