Compare commits

...

145 Commits

Author SHA1 Message Date
Federico Grandi
b3c7c1e078 release: v7.0.0 2021-01-16 17:16:11 +01:00
Federico Grandi
267e04bd5b chore: remove obsolete input from Input type 2021-01-16 17:14:41 +01:00
Federico Grandi
fab2511822 chore(deps): bump js-yaml 2021-01-16 16:57:37 +01:00
allcontributors[bot]
57a540778b docs: add ocean90 as a contributor (#134)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2021-01-16 16:05:03 +01:00
Dominik Schilling
e59e7a1912 [auto] build: update compiled version 2021-01-16 15:04:02 +00:00
Dominik Schilling
9c056146c1 Use github.actor as default value for commit author (#128) 2021-01-16 16:03:32 +01:00
dependabot[bot]
1146c681e3 chore(deps-dev): bump eslint-plugin-prettier from 3.3.0 to 3.3.1 (#133)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
2021-01-11 08:20:07 +01:00
dependabot[bot]
e3e22e1068 chore(deps-dev): bump @vercel/ncc from 0.26.1 to 0.26.2 (#132)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.26.1 to 0.26.2.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.26.1...0.26.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 08:03:34 +01:00
dependabot[bot]
544fb5f507 chore(deps-dev): bump husky from 4.3.6 to 4.3.7 (#130)
Bumps [husky](https://github.com/typicode/husky) from 4.3.6 to 4.3.7.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.6...v4.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 08:02:49 +01:00
allcontributors[bot]
60c76066ae docs: add ocean90 as a contributor (#129)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2021-01-05 17:10:04 +01:00
Dominik Schilling
b09a3f1699 docs: update explanation for token input (#125)
* chore(docs): Update explanation for token input

* docs: move token info to dedicated paragraph

* Fix typos

Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
2021-01-05 17:09:01 +01:00
allcontributors[bot]
299226adbb docs: add ocean90 as a contributor (#127)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2021-01-04 21:32:14 +01:00
Federico Grandi
be3ffdfa40 [auto] build: update compiled version 2021-01-04 20:25:14 +00:00
Federico Grandi
ccb8558604 chore: add git attributes 2021-01-04 21:24:21 +01:00
Federico Grandi
03660a0218 fix: don't try to fill author info when not needed
fix #126
2021-01-04 21:23:21 +01:00
dependabot[bot]
941a2d657a chore(deps): bump axios from 0.21.0 to 0.21.1 (#122)
Bumps [axios](https://github.com/axios/axios) from 0.21.0 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.0...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-28 16:57:02 +01:00
Federico Grandi
dbf207a670 chore(docs): switch to dynamic all-contributors badge 2020-12-23 14:27:27 +01:00
Federico Grandi
234011c0f7 docs(README): use markdown for "used by" badge 2020-12-23 14:19:51 +01:00
Federico Grandi
a536a7f5fc docs(README): fix "used by" badge link 2020-12-23 14:11:14 +01:00
allcontributors[bot]
951eefe413 [auto] docs: update contributors badge 2020-12-23 13:05:33 +00:00
allcontributors[bot]
d7568d6287 docs: add PssbleTrngle as a contributor (#119)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-12-23 14:05:10 +01:00
Federico Grandi
a837bd27d9 release: v6.2.0 2020-12-23 13:28:13 +01:00
Federico Grandi
9986de0edd [auto] build: update compiled version 2020-12-23 12:02:48 +00:00
Federico Grandi
a51640c51f feat: support git push arguments
ref issue #100
2020-12-23 12:55:50 +01:00
Federico Grandi
d1d225c38f chore(changelog): fix changelog script
There was an issue with the "unreleased" link tag, which had been
converted to lowercase by Prettier.
2020-12-22 21:32:06 +01:00
Federico Grandi
a26f63b0ce release: v6.1.0 2020-12-22 21:17:24 +01:00
Federico Grandi
a71372f9dd ci: add test workflow 2020-12-22 21:01:22 +01:00
Federico Grandi
7bdc8af1b2 [auto] build: update compiled version 2020-12-22 19:32:08 +00:00
Federico Grandi
5c9f1f7cef fix: add a couple of debug lines 2020-12-22 20:31:18 +01:00
Federico Grandi
d84d80e417 [auto] build: update compiled version 2020-12-22 19:28:50 +00:00
Federico Grandi
4d73263e3e fix: add 'token' to Input type 2020-12-22 20:27:21 +01:00
allcontributors[bot]
b8f7f0eada docs: add Cyberbeni as a contributor (#118)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-12-22 20:19:04 +01:00
Benedek Kozma
75a30a545a feat: deprecate GITHUB_TOKEN env var and use token input instead with default value (#112)
* deprecate GITHUB_TOKEN env var and use token input instead with default value

* update readme

* npm run lint:fix
2020-12-22 20:18:16 +01:00
Federico Grandi
401756f9f0 docs: update major version tag 2020-12-22 20:15:58 +01:00
Federico Grandi
21ed6afecd docs: add issue ref in last change 2020-12-22 16:40:04 +01:00
Federico Grandi
388ce4f475 release: v6.0.0 2020-12-22 16:36:14 +01:00
Federico Grandi
a2ca498476 docs: add info on how to use input arrays 2020-12-22 16:35:09 +01:00
allcontributors[bot]
60e7d47c17 [auto] docs: update contributors badge 2020-12-22 15:20:51 +00:00
allcontributors[bot]
4215dc951b docs: add trallnag as a contributor (#117)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-12-22 16:20:22 +01:00
dependabot[bot]
33836ed288 chore(deps-dev): bump @vercel/ncc from 0.25.1 to 0.26.1 (#116)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.25.1 to 0.26.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.25.1...0.26.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-21 08:09:31 +01:00
dependabot[bot]
6fcd798e4a chore(deps): bump js-yaml from 3.14.0 to 3.14.1 (#115)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.0 to 3.14.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/3.14.1/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.14.0...3.14.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-21 08:09:20 +01:00
Federico Grandi
50a62d9e15 [auto] build: update compiled version 2020-12-19 20:46:12 +00:00
Federico Grandi
9e04524704 chore: fix mess made by merge 2020-12-19 21:44:23 +01:00
Federico Grandi
6f812a4e2c Support YAML/JSON arrays for add and remove inputs (#114)
* feat: support arrays as add/remove inputs

re #95

* chore: add debug log for parsed input type
2020-12-19 21:37:26 +01:00
dependabot[bot]
f11ed1f3d2 chore(deps-dev): bump husky from 4.3.0 to 4.3.6 (#109)
Bumps [husky](https://github.com/typicode/husky) from 4.3.0 to 4.3.6.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.0...v4.3.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-19 17:09:39 +01:00
dependabot[bot]
ab2f7e88a9 chore(deps-dev): bump typescript from 4.1.2 to 4.1.3 (#108)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-19 17:08:03 +01:00
dependabot[bot]
7209b6038a chore(deps-dev): bump eslint-plugin-prettier from 3.2.0 to 3.3.0 (#107)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.2.0...v3.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-19 17:07:54 +01:00
Federico Grandi
b17846f438 Upgrade simple-git (#111)
* chore: upgrade simple-git

* [auto] build: update compiled version
2020-12-19 17:05:44 +01:00
Federico Grandi
da58dc8f9a chore: disable custom blank issues 2020-12-13 10:42:52 +01:00
Federico Grandi
4e0f991445 chore: update issue templates 2020-12-13 10:40:26 +01:00
dependabot[bot]
b71678be3e chore(deps-dev): bump eslint-plugin-prettier from 3.1.4 to 3.2.0 (#103)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.4 to 3.2.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.4...v3.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-12 17:59:57 +01:00
dependabot[bot]
f21bebd7d3 chore(deps-dev): bump ts-node from 9.0.0 to 9.1.1 (#104)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.0.0 to 9.1.1.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v9.0.0...v9.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-12 17:59:28 +01:00
allcontributors[bot]
d0143fb99e docs: add ewjoachim as a contributor (#105)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-12-12 17:59:11 +01:00
Federico Grandi
d192ad0aba release: v5.3.0 2020-12-12 17:51:51 +01:00
Federico Grandi
3bee5aeb33 docs(README): add outputs info 2020-12-12 17:44:28 +01:00
Federico Grandi
5cb8787442 [auto] build: update compiled version 2020-12-12 16:07:50 +00:00
Federico Grandi
334c6c32a5 fix(outputs): keep failing on tag error
This is just not to introduce breaking changes
2020-12-12 17:07:05 +01:00
Federico Grandi
d4b7879e16 [auto] build: update compiled version 2020-12-12 16:02:02 +00:00
Federico Grandi
d8573f888f fix(tag): fix tag logs
It seems like simple-git handlers don't work for custom git tag commands
Promises still work, we'll try to use them then
2020-12-12 17:01:09 +01:00
Federico Grandi
cac5e6ba5b [auto] build: update compiled version 2020-12-12 15:37:41 +00:00
Federico Grandi
655a68b116 fix(outputs): fix outputs not displaying in logs 2020-12-12 16:36:50 +01:00
Federico Grandi
524f96d401 fix(build): re-enable lib minification 2020-12-12 16:33:38 +01:00
Federico Grandi
28ab8fcce3 Merge branch 'master' of https://github.com/EndBug/add-and-commit 2020-12-12 16:33:03 +01:00
Federico Grandi
6da0ea7f9b fix(outputs): add debug log 2020-12-12 16:32:21 +01:00
Federico Grandi
11a529635a [auto] build: update compiled version 2020-12-12 15:26:19 +00:00
Federico Grandi
bc31c50167 fix(outputs): update output format in log 2020-12-12 16:25:26 +01:00
Federico Grandi
07e991cfab [auto] build: update compiled version 2020-12-06 16:44:04 +00:00
Federico Grandi
0f3c8c6996 fix(util): fix build issue
This may be caused by ncc not correctly using edModuleInterlop
2020-12-06 17:43:05 +01:00
Federico Grandi
0f070625cd chore(build): don't minify build 2020-12-06 17:31:53 +01:00
Federico Grandi
ed8cbae509 [auto] build: update compiled version 2020-12-06 10:31:36 +00:00
Federico Grandi
4b5a2df0dd chore(build): minify build 2020-12-06 11:30:50 +01:00
Federico Grandi
c8e1fb0d1b [auto] build: update compiled version 2020-12-05 15:35:39 +00:00
Federico Grandi
fe1fb219a6 feat: add outputs
re #96
2020-12-05 16:34:50 +01:00
Federico Grandi
28fa18d5af chore(build): don't minify build 2020-12-05 16:04:15 +01:00
Federico Grandi
a0873811e5 chore(deps): lock simple-git version 2020-12-05 16:03:39 +01:00
Federico Grandi
40e84d601c chore(husky): don't commit src folder 2020-12-05 16:02:49 +01:00
Federico Grandi
ec13f51fd9 [auto] build: update compiled version 2020-11-29 17:05:43 +00:00
Federico Grandi
3140d34146 chore: add prettier 2020-11-29 17:51:26 +01:00
Federico Grandi
3ed8463058 chore: remove compiled imputs 2020-11-29 17:41:48 +01:00
dependabot[bot]
ea1d3cefff chore(deps-dev): bump typescript from 4.0.5 to 4.1.2 (#94)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.0.5 to 4.1.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.0.5...v4.1.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-23 09:57:39 +01:00
dependabot[bot]
e298441a67 chore(deps): bump simple-git from 2.22.0 to 2.23.0 (#93)
Bumps [simple-git](https://github.com/steveukx/git-js) from 2.22.0 to 2.23.0.
- [Release notes](https://github.com/steveukx/git-js/releases)
- [Changelog](https://github.com/steveukx/git-js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/steveukx/git-js/compare/v2.22.0...v2.23.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-23 09:51:25 +01:00
Federico Grandi
4387feb4b8 chore: add bug issue template 2020-11-18 18:59:52 +01:00
dependabot[bot]
cfa65e13b2 chore(deps): bump simple-git from 2.21.0 to 2.22.0 (#92)
Bumps [simple-git](https://github.com/steveukx/git-js) from 2.21.0 to 2.22.0.
- [Release notes](https://github.com/steveukx/git-js/releases)
- [Changelog](https://github.com/steveukx/git-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/steveukx/git-js/compare/v2.21.0...v2.22.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-16 16:00:41 +01:00
Federico Grandi
eb9afeffe2 [auto] build: update compiled version 2020-11-11 18:00:17 +00:00
Federico Grandi
110b7e289f ci(gh-actions): limit ci actions to master branch
This causes issues when a release is published, because the build scripts create a new branch
because of the new tag that gets automatically pushed by GitHub
2020-11-11 18:59:15 +01:00
Federico Grandi
57c075ed5f release: v5.2.0 2020-11-11 18:34:50 +01:00
allcontributors[bot]
dd36cc6914 docs: add kbsali as a contributor (#91)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* [auto] docs: update contributors badge

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-11-11 18:29:40 +01:00
Federico Grandi
15f07d3078 [auto] build: update compiled version 2020-11-11 17:15:54 +00:00
Federico Grandi
c0c96adb24 docs(push): update docs for the push parameter 2020-11-11 18:15:00 +01:00
Federico Grandi
b36969554e feat(push): add push option
re #86
2020-11-11 18:11:50 +01:00
allcontributors[bot]
0c6f4a1284 docs: add Chocrates as a contributor (#90)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* [auto] docs: update contributors badge

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-11-10 15:44:24 +01:00
Federico Grandi
9358097a71 release: v5.1.2 2020-11-10 08:10:33 +01:00
dependabot[bot]
ed17cacb74 chore(deps-dev): bump @vercel/ncc from 0.24.1 to 0.25.1 (#87)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.24.1 to 0.25.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.24.1...0.25.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-09 22:52:04 +01:00
Federico Grandi
e0cd865b68 build(husky): add build files 2020-11-07 14:02:30 +01:00
Federico Grandi
ed7b74af50 release: v5.1.1 2020-11-07 13:59:56 +01:00
allcontributors[bot]
8c0903ea07 docs: add coffeegoddd as a contributor (#84)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* [auto] docs: update contributors badge

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-11-07 13:52:16 +01:00
Dustin Brown
29856365a6 [auto] build: update compiled version 2020-11-07 12:50:49 +00:00
Dustin Brown
a7661122af /{action.yml, src/}: fix typo (#83) 2020-11-07 13:50:19 +01:00
dependabot[bot]
1181181b70 chore(deps): bump simple-git from 2.19.0 to 2.21.0 (#80)
Bumps [simple-git](https://github.com/steveukx/git-js) from 2.19.0 to 2.21.0.
- [Release notes](https://github.com/steveukx/git-js/releases)
- [Changelog](https://github.com/steveukx/git-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/steveukx/git-js/compare/v2.19.0...v2.21.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-02 08:05:47 +01:00
dependabot[bot]
32090e561e chore(deps-dev): bump typescript from 4.0.2 to 4.0.5 (#81)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.0.2 to 4.0.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.0.2...v4.0.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-02 08:03:06 +01:00
Federico Grandi
07a46e3fca [auto] build: update compiled version 2020-10-29 08:03:05 +00:00
Federico Grandi
b43e3143da ci: remove unnecessary --force 2020-10-29 09:01:50 +01:00
Federico Grandi
9c99934303 chore: remove lib from .gitignore 2020-10-29 08:50:02 +01:00
Federico Grandi
34757b89f7 chore: add husky for building 2020-10-29 08:46:41 +01:00
dependabot[bot]
e3b93a10e2 chore(deps-dev): bump @vercel/ncc from 0.23.0 to 0.24.1 (#77)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.23.0 to 0.24.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.23.0...0.24.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-29 08:41:29 +01:00
Federico Grandi
b043969cfd [auto] build: update compiled version 2020-10-29 07:40:53 +00:00
Federico Grandi
101829e6c0 fix: fix build error 2020-10-29 08:40:06 +01:00
dependabot[bot]
8cd8f9f071 chore(deps-dev): bump all-contributors-cli from 6.17.2 to 6.19.0 (#76)
Bumps [all-contributors-cli](https://github.com/all-contributors/all-contributors-cli) from 6.17.2 to 6.19.0.
- [Release notes](https://github.com/all-contributors/all-contributors-cli/releases)
- [Commits](https://github.com/all-contributors/all-contributors-cli/compare/v6.17.2...v6.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-29 08:36:37 +01:00
dependabot[bot]
c010bcbe2f chore(deps): bump axios from 0.19.2 to 0.21.0 (#74)
Bumps [axios](https://github.com/axios/axios) from 0.19.2 to 0.21.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.19.2...v0.21.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-29 08:34:50 +01:00
dependabot[bot]
1b176ae96b chore(deps-dev): bump ts-node from 8.10.2 to 9.0.0 (#73)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.0.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v8.10.2...v9.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-29 08:34:32 +01:00
Jose Eduardo Kimura
ecdc355d15 fix: Fix missing pull strategy for simple-git (#72)
Closes #71
2020-10-29 08:33:40 +01:00
Federico Grandi
79fae44cb3 ci: fix dependabot.yml 2020-10-29 08:31:33 +01:00
Federico Grandi
34b3c277a4 ci: add dependabot config 2020-10-19 09:52:03 +02:00
Federico Grandi
bd911ffe7e ci: add label-sync 2020-10-19 09:47:38 +02:00
Federico Grandi
e6f30b78b7 ci: fix action ref 2020-10-17 09:30:15 +02:00
Federico Grandi
9145a27b50 ci: export repo labels 2020-10-17 09:27:55 +02:00
Federico Grandi
b5dec7ea76 release: v5.1.0 2020-10-07 20:08:48 +02:00
allcontributors[bot]
0c4298a18d docs: add Cyberbeni as a contributor (#65)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* [auto] docs: update contributors badge

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-10-07 20:05:18 +02:00
Federico Grandi
37e118a1f5 [auto] build: update compiled version 2020-10-07 17:51:23 +00:00
Federico Grandi
3088d83852 feat: show workflow name in deafult commit message
Ref: #64
2020-10-07 19:50:38 +02:00
dependabot[bot]
3f6e296fa8 chore(deps): bump @actions/core from 1.2.4 to 1.2.6 (#62)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-01 19:57:23 +02:00
Federico Grandi
82c397024b ci: change status labels 2020-09-27 12:01:38 +02:00
Federico Grandi
55e3676294 docs: formatting improvements 2020-09-27 11:39:12 +02:00
Federico Grandi
cbeb36fdb1 fix: remove old link 2020-09-27 11:37:25 +02:00
Federico Grandi
15954de18f release: v5.0.0 2020-09-27 11:34:50 +02:00
dependabot[bot]
1d34a38003 chore(deps): bump node-fetch from 2.6.0 to 2.6.1 (#60)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-09-25 08:48:20 +02:00
Federico Grandi
8693022acf Rewrite: TypeScript-only (#57)
* chore(deps): bump dependecies

* chore: add "inputs" script

* chore: commit local work

* chore: delete lib folder

* chore: commit local work

* BREAKING: edit action options

- force has been deleted, pass the '-f' parameter to add and remove
- ref is now called branch

* [auto] build: update compiled version

* chore: improve input checks

* [auto] build: update compiled version

* fix: pathspec errors should be catched differently

* [auto] build: update compiled version

* fix: check for 'add' and 'remove' before running commands

* [auto] build: update compiled version

* fix: log git commands

* [auto] build: update compiled version

* fix: improve logs' readability

* [auto] build: update compiled version

* chore: try not resetting files

* [auto] build: update compiled version

* fix: ignore errors on 2nd stage, log them on 1st

* [auto] build: update compiled version

* fix: signoff

* [auto] build: update compiled version

* fix: log git tag output

* [auto] build: update compiled version

* fix: use proper method for tagging

* [auto] build: update compiled version

* fix: use dedicated method for pushing tags

* [auto] build: update compiled version

* fix: using pure git tag command is better

* [auto] build: update compiled version

* fix: improve error handling

* [auto] build: update compiled version

* fix: I messed up the lines

* [auto] build: update compiled version

* fix: fix tags push when there's a forced update

* [auto] build: update compiled version

* fix: log errors too

* chore: remove unused dependecy

* [auto] build: update compiled version

* fix: don't log when using ignoreErrors

* [auto] build: update compiled version

* fix: fetch tags

* [auto] build: update compiled version

* fix: try forcing tag fetch

* [auto] build: update compiled version

* fix: try using original command for pushing tags

* [auto] build: update compiled version

* fix: try removing repo from tag command

* [auto] build: update compiled version

* fix: try with object options

* [auto] build: update compiled version

* i don't even know anymore

* [auto] build: update compiled version

* fix: try deleting the tag when it's rejected

* [auto] build: update compiled version

* fix: isolate tag name

* [auto] build: update compiled version

* fix: log result of tag deletion

* [auto] build: update compiled version

* fix: use actual values instead of references

* [auto] build: update compiled version

* fix: join netrc path with module

* [auto] build: update compiled version

* fix-: try not using .netrc at all

* [auto] build: update compiled version

* fix: remove .netrc config

* [auto] build: update compiled version

* chore: remove old shell file

* docs: update README

* chore: fix typo in action manifest

* chore: move ncc to dev-deps

* fix: cwd not working properly

* [auto] build: update compiled version
2020-09-25 08:27:39 +02:00
Federico Grandi
c7b685622a ci: fix old message 2020-09-16 08:40:49 +02:00
Federico Grandi
56800c1fe2 ci: change "stale" limit to 20 days 2020-09-16 08:35:50 +02:00
Federico Grandi
d7ef3f3a99 ci: change name to "stale" workflow 2020-08-21 14:15:47 +02:00
Federico Grandi
e9dd7a4420 ci: add "stale" workflow 2020-08-21 14:14:45 +02:00
Federico Grandi
f5a3783aa2 [auto] build: update compiled version 2020-08-21 11:33:27 +00:00
Federico Grandi
208182ae37 fix: add warning when GITHUB_TOKEN is not present
Ref issue #51
2020-08-21 13:32:46 +02:00
Federico Grandi
f7d13fceb9 docs: add changelog 2020-08-11 23:20:37 +02:00
Federico Grandi
360b5ee4b9 [auto] build: update compiled version 2020-08-11 20:17:52 +00:00
Federico Grandi
6f5455c37d fix: catch GItHub API call rejections
ref: issue #51
2020-08-11 22:17:04 +02:00
Federico Grandi
4e2f1656df ci: use bump version of this action 2020-08-08 11:02:41 +02:00
Federico Grandi
5348e90423 fix: fix build error 2020-08-08 10:54:37 +02:00
Federico Grandi
a740f7e935 docs: use custom <a> tag for "used by" badge 2020-08-05 12:17:51 +02:00
Federico Grandi
590bebf249 chore: add workflow_dispatch 2020-08-05 12:10:54 +02:00
Federico Grandi
9650af1f95 docs: add "used by" badge 2020-08-05 12:09:59 +02:00
Federico Grandi
ced56a7226 chore: switch to workflow for contributors badge 2020-08-05 12:02:19 +02:00
Federico Grandi
a988073222 release: v4.4.0 2020-07-31 20:55:15 +02:00
allcontributors[bot]
88408e5833 docs: add connorjclark as a contributor (#50)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2020-07-31 20:52:03 +02:00
Federico Grandi
27a89ad786 feat: add PR support (#49)
* feat: add PR support

* add debug steps

* fix: use console

* fix: fix buil error

* [auto] build: update compiled version

* fix: better branch handling

* [auto] build: update compiled version

* chore: remove debug steps

* fix: fetch author using GitHub API when in PR

* [auto] build: update compiled version

* feat: extend API functionality to non-PR runs

* [auto] build: update compiled version
2020-07-31 20:47:38 +02:00
30 changed files with 1745 additions and 859 deletions

View File

@@ -129,6 +129,90 @@
"contributions": [
"code"
]
},
{
"login": "connorjclark",
"name": "Connor Clark",
"avatar_url": "https://avatars1.githubusercontent.com/u/4071474?v=4",
"profile": "http://hoten.cc",
"contributions": [
"ideas"
]
},
{
"login": "Cyberbeni",
"name": "Benedek Kozma",
"avatar_url": "https://avatars1.githubusercontent.com/u/8356175?v=4",
"profile": "https://github.com/Cyberbeni",
"contributions": [
"ideas",
"code"
]
},
{
"login": "coffeegoddd",
"name": "Dustin Brown",
"avatar_url": "https://avatars3.githubusercontent.com/u/43383835?v=4",
"profile": "https://github.com/coffeegoddd",
"contributions": [
"bug"
]
},
{
"login": "Chocrates",
"name": "Chris McIntosh",
"avatar_url": "https://avatars1.githubusercontent.com/u/1758164?v=4",
"profile": "https://github.com/Chocrates",
"contributions": [
"bug"
]
},
{
"login": "kbsali",
"name": "Kevin Saliou",
"avatar_url": "https://avatars0.githubusercontent.com/u/53676?v=4",
"profile": "https://github.com/kbsali",
"contributions": [
"ideas"
]
},
{
"login": "ewjoachim",
"name": "Joachim Jablon",
"avatar_url": "https://avatars0.githubusercontent.com/u/1457576?v=4",
"profile": "https://github.com/ewjoachim",
"contributions": [
"ideas"
]
},
{
"login": "trallnag",
"name": "Tim Schwenke",
"avatar_url": "https://avatars3.githubusercontent.com/u/24834206?v=4",
"profile": "https://github.com/trallnag",
"contributions": [
"ideas"
]
},
{
"login": "PssbleTrngle",
"name": "Possible Triangle",
"avatar_url": "https://avatars1.githubusercontent.com/u/12880806?v=4",
"profile": "https://www.somethingcatchy.net",
"contributions": [
"ideas"
]
},
{
"login": "ocean90",
"name": "Dominik Schilling",
"avatar_url": "https://avatars2.githubusercontent.com/u/617637?v=4",
"profile": "https://dominikschilling.de",
"contributions": [
"ideas",
"doc",
"code"
]
}
],
"contributorsPerLine": 7,

View File

@@ -1,63 +0,0 @@
{
"env": {
"node": true,
"browser": true,
"amd": true,
"es6": true
},
"root": true,
"extends": [
"eslint:recommended"
],
"plugins": [
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"no-cond-assign": [
2,
"except-parens"
],
"no-use-before-define": [
2,
{
"functions": false,
"classes": false,
"variables": false
}
],
"new-cap": 0,
"no-caller": 2,
"no-undef": 2,
"no-unused-vars": 1,
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-console": "off",
"prefer-const": [
"warn",
{
"destructuring": "all"
}
],
"quotes": [
"warn",
"single"
],
"semi": [
"warn",
"never"
],
"spaced-comment": "warn"
}
}

38
.eslintrc.js Normal file
View File

@@ -0,0 +1,38 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: [
'eslint:recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended'
],
globals: {},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'prettier/prettier': 'warn',
'no-cond-assign': [2, 'except-parens'],
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
'no-empty': [
'error',
{
allowEmptyCatch: true
}
],
'prefer-const': [
'warn',
{
destructuring: 'all'
}
],
'spaced-comment': 'warn'
}
}

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
* text=auto eol=lf
lib/* linguist-generated

10
.github/ISSUE_TEMPLATE/blank-issue.md vendored Normal file
View File

@@ -0,0 +1,10 @@
---
name: Blank issue
about: Just a blank template
title: ''
labels: 'status: pending'
assignees: ''
---

24
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,24 @@
---
name: Bug report
about: Report an issue with the action
title: ''
labels: 'status: pending'
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is. If a particular error is shown
**Workflow used**
Provide a snippet of the workflow and/or a link to it (use the commit sha as the ref when you link it, so that it's not influenced by other changes). If you only share a section of the workflow, make sure it includes the step that uses the action!
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs**
Either provide a link to the action run or (if your repo is private) paste here the logs from the step that uses it. If you paste the logs, please use this template, and remember to paste the logs from all the different sections.
<details>
<summary>Logs</summary>
<pre><code>Your logs here.</code></pre>
</details>

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: false

10
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@@ -0,0 +1,10 @@
---
name: Question
about: Ask a question on how to use the action
title: ''
labels: 'type: question'
assignees: ''
---

16
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: 'weekly'
commit-message:
prefix: 'chore'
include: 'scope'
labels:
- 'type: dependencies'

80
.github/labels.yml vendored Normal file
View File

@@ -0,0 +1,80 @@
# General purpose
- name: 'good first issue'
color: '5319e7'
description: 'Good for newcomers'
aliases: []
- name: 'help wanted'
color: '008672'
description: 'Extra attention is needed'
aliases: []
- name: 'status: pending'
color: c5def5
description: 'More info is needed before deciding what to do.'
aliases: []
- name: 'status: pinned'
color: 0052cc
description: 'Issues and PRs that should not be labeled as stale or closed if they remain inactive.'
aliases: []
- name: 'status: stale'
color: fbca04
description: 'Inactive issues and PRs.'
aliases: ['stale']
- name: 'status: wontfix'
color: ffffff
description: 'This will not be worked on.'
aliases: ['wontfix']
- name: 'type: automation'
color: 2fc904
description: 'About actions workflows and automation.'
aliases: ['automation', 'actions']
- name: 'type: bug'
color: d73a4a
description: 'Verified problems that need to be worked on.'
aliases: ['bug']
- name: 'type: dependencies'
color: 0366d6
description: 'Pull requests that update a dependency file'
aliases: ['dependencies']
- name: 'type: duplicate'
color: cfd3d7
description: 'This issue or pull request already exists.'
aliases: ['duplicate']
- name: 'type: enhancement'
color: a2eeef
description: 'New feature or request.'
aliases: ['enhancement']
- name: 'type: invalid'
color: e4e669
description: "This doesn't seem right."
aliases: ['invalid']
- name: 'type: maintenance'
color: 0075ca
description: "Documentation improvements and code refactoring, doesn't affect functionality."
aliases: ['documentation', 'docs']
- name: 'type: not a bug'
color: 0e8a16
description: 'Reports that happen not be our fault.'
aliases: ['not a bug']
- name: 'type: question'
color: d876e3
description: 'Further information is requested.'
aliases: ['question']
- name: 'type: security'
color: 'ee0701'
description: 'Pull requests that address a security vulnerability.'
aliases: ['security']

View File

@@ -1,36 +1,31 @@
name: Build
on:
push:
branches-ignore:
- dist
branches:
- master
paths:
- src/**
- .github/workflows/build.yml
workflow_dispatch:
jobs:
build:
name: Build compiled JS version
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install
- run: npm install
- name: Compile TypeScript into compressed JavaScript
run: npm run build
- run: npm run build
- name: Commit changes
uses: EndBug/add-and-commit@v4.0.0
- uses: EndBug/add-and-commit@v4
with:
message: "[auto] build: update compiled version"
message: '[auto] build: update compiled version'
add: lib
force: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

21
.github/workflows/export-labels.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Export label config
on:
# You can run this with every event, but it's better to run it only when you actually need it.
workflow_dispatch:
jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: EndBug/export-label-config@main
with:
# This is needed if you're dealing with private repos.
token: ${{ secrets.GITHUB_TOKEN }}
# Set this to `true` if you want to get the raw API reponse. Defaults to `false`.
raw-result: false
# By default every label entry will have an `aliases` property set to an empty array.
# It's for EndBug/label-sync, if you don't want it you cans set this to `false`
add-aliases: true

19
.github/workflows/label-sync.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Sync labels
on:
push:
branches:
- master
paths:
- '.github/labels.yml'
workflow_dispatch:
jobs:
sync:
name: Run EndBug/label-sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EndBug/label-sync@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: '.github/labels.yml'

21
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: 'Handle stale issues and PRs'
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is being marked as "stale" because it has been open 20 days with no activity. Remove the "stale" label or comment, otherwise this will be closed in 5 days.'
stale-issue-label: 'status: stale'
exempt-issue-labels: 'status: pinned'
stale-pr-message: 'This PR is being marked as "stale" because it has been open 20 days with no activity. Remove the "stale" label or comment, otherwise this will be closed in 5 days.'
stale-pr-label: 'status: stale'
exempt-pr-labels: 'status: pinned'
days-before-stale: 20
days-before-close: 5

22
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Test
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Test build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run build
lint:
name: Check linting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run lint

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
node_modules
build
lib

7
.prettierrc Normal file
View File

@@ -0,0 +1,7 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "none"
}

245
CHANGELOG.md Normal file
View File

@@ -0,0 +1,245 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [7.0.0] - 2021-01-16
### Changed:
- **[BREAKING]** The token input has been removed: author info will be filled using the GitHub Actor, instead of fetching info from the GitHub API.
The commits will be authored using the GitHub no-reply email associated with the account: username@users.noreply.github.com
- **[BREAKING]** Because of the change above, the author will now be the user that triggered the action run, and not the author of the last commit: while the two are often the same person, there are instances where they might differ (e.g. when a workflow run is triggered manually).
## [6.2.0] - 2020-12-23
### Added:
- `push` input: allow for custom `git push` arguments to be used, more info in the README. (issue #100)
## [6.1.0] - 2020-12-22
### Added:
- `token` input: you can now use this instead of setting the `GITHUB_TOKEN` env variable, which has been deprecated. This input is optional, its default value is the default `secrets.GITHUB_TOKEN`. You only need to use this if you want the action to run with a PAT. (issue #110)
### Deprecated:
- `GITHUB_TOKEN`: the use of this env variable is now deprecated in favor of the `token` input, you'll start receiving warnings if you keep using it. (issue #110)
## [6.0.0] - 2020-12-22
### Added:
- (BREAKING?) Multiple git commands: support JSON/YAML arrays for the `add` and `remove` parameters (you still need pass a string as input, but that can be parsed to an array by the action). Using them will run multiple commands in succession. I don't think this will be really breaking anything, but I've used a major version change just to be sure. There's more info about this stuff on the README. (issue #95)
## [5.3.0] - 2020-12-12
### Added:
- Outputs: the action now has 3 outputs (`committed`, `pushed`, and `tagged`) that will be set to either `true` or `false` to tell you what the action has done. The outputs are also shown in the action logs.
## [5.2.0] - 2020-11-11
### Added:
- New `push` option: this lets you tell the action whether to push commit and tags to the repo. The default value is `true`, so that the default behavior is not changed. (issue #86)
## [5.1.2] - 2020-11-10
### Fixed:
- Fixed an issue with the build (issue #88)
## [5.1.1] - 2020-11-07
### Fixed:
- Fixed typo in parameter name: `pull_strategy` was written as `pull_stategy` (PR #83)
## [5.1.0] - 2020-10-07
### Added:
- The default commit message now displays the name of the workflow too (issue #64)
## [5.0.0] - 2020-09-27
### Changed:
- **[BREAKING]** Action parameters: multiple action parameters have been changed, refer to the docs for better info
- The code is now entirely in TypeScript (PR #57)
### Fixed:
- Improved input checks
- Logs are now displayed on Windows too
- Remove unnecessary steps
- Remove unused dependencies
## [4.4.0] - 2020-07-31
### Added:
- Pull requests: the action can now work in runs triggered by pull request events (issue #48)
## [4.3.0] - 2020-07-29
### Addded:
- `signoff` parameter: lets you use the `--signoff` argument for the `git commit` command (PR #46)
## [4.2.1] - 2020-07-10
### Fixed:
- OS-support: the action now properly works on Windows instances (issue #33)
## [4.2.0] - 2020-05-17
### Added:
- Tagging: you can now create and update lightweight tags (PR #30)
## [4.1.0] - 2020-05-01
### Added:
- `ref` parameter: lets you choose the branch to run the action on, the default is the one that triggered the workflow (issue #29)
## [4.0.3] - 2020-05-01
### Fixed:
- Logs: `git diff` won't display logs anymore, to avoid buffer problems (issue #27)
- Logs: additional info will be logged along with the command outputs
- Logs: added groups to improve readability
## [4.0.2] - 2020-04-19
### Fixed:
- Error handling: failures are now easier to read (issue #25)
## [4.0.1] - 2020-03-20
### Fixed:
- Scheduled events: the action can be used in action runs triggered by a scheduled events
- Warnings: there won't be warnings when both `author_name` and `author_email` are set
## [4.0.0] - 2020-03-03
### Removed:
- **[BREAKING]** `path` parameter: see 'Changed' section for more info
- **[BREAKING]** `pattern` parameter: see 'Changed' section for more info
### Changed:
- The action now uses `git add` and `git rm` commands, you can choose their arguemnts directly by using the `add` and `remove` parameters
- **[BREAKING]** Error handling: the action won't stop if one of your git commands fails (e.g. if one of your pathspecs doesn't match any file)
## [3.1.0] - 2020-02-21
### Added:
- `remove` parameter: lets you delete files directly from the action
## [3.0.0] - 2020-01-24
### Added:
- The action can now run in multiple subsequent jobs in the same workflow
### Removed:
- **[BREAKING]** [`actions/checkout@v1`](https://github.com/actions/checkout/tree/v1) support is being dropped in favor of [`actions/checkout@v2`](https://github.com/actions/checkout/releases/tag/v2)
## [2.3.2] - 2019-12-29
### Added:
- `cwd` parameter: lets you set the Current Working Directory
## [2.3.1] - 2019-12-20
### Added:
- Short tags: from now on, there will be short major tags available (`v2`, `v3`, ...)
## [2.3.0] - 2019-12-14
### Changed:
- TypeScript rewrite: the action will run faster because, unlike with Docker, no build process is needed
### Added:
- OS support: the action can now run in non-Linux environments too
## [2.2.0] - 2019-12-14
### Added:
- The action can automatically fetch the commit author to use
- You can manually provide the author using the `author_name` and `author_email` parameters
## [2.1.1] - 2019-12-07
### Fixed:
- The action can now be used multiple times in the same workflow
## [2.1.0] - 2019-09-19
### Added:
- `force` parameter: uses `--force` when running `git add`
## [2.0.0] - 2019-09-18
### Changed:
- **[BREAKING]** The action now uses a `find` command
## [1.0.0] - 2019-09-17
First release
#
[unreleased]: https://github.com/EndBug/add-and-commit/compare/v7.0.0...HEAD
[1.0.0]: https://github.com/EndBug/add-and-commit/tree/v1.0.0
[2.0.0]: https://github.com/EndBug/add-and-commit/compare/v1.0.0...v2.0.0
[2.1.0]: https://github.com/EndBug/add-and-commit/compare/v2.0.0...v2.1.0
[2.1.1]: https://github.com/EndBug/add-and-commit/compare/v2.1.0...v2.1.1
[2.2.0]: https://github.com/EndBug/add-and-commit/compare/v2.1.1...v2.2.0
[2.3.0]: https://github.com/EndBug/add-and-commit/compare/v2.2.0...v2.3.0
[2.3.1]: https://github.com/EndBug/add-and-commit/compare/v2.3.0...v2.3.1
[2.3.2]: https://github.com/EndBug/add-and-commit/compare/v2.3.1...v2.3.2
[3.0.0]: https://github.com/EndBug/add-and-commit/compare/v2.3.2...v3.0.0
[3.1.0]: https://github.com/EndBug/add-and-commit/compare/v3.0.0...v3.1.0
[4.0.0]: https://github.com/EndBug/add-and-commit/compare/v3.1.0...v4.0.0
[4.0.1]: https://github.com/EndBug/add-and-commit/compare/v4.0.0...v4.0.1
[4.0.2]: https://github.com/EndBug/add-and-commit/compare/v4.0.1...v4.0.2
[4.0.3]: https://github.com/EndBug/add-and-commit/compare/v4.0.2...v4.0.3
[4.1.0]: https://github.com/EndBug/add-and-commit/compare/v4.0.3...v4.1.0
[4.2.0]: https://github.com/EndBug/add-and-commit/compare/v4.1.0...v4.2.0
[4.2.1]: https://github.com/EndBug/add-and-commit/compare/v4.2.0...v4.2.1
[4.3.0]: https://github.com/EndBug/add-and-commit/compare/v4.2.1...v4.3.0
[4.4.0]: https://github.com/EndBug/add-and-commit/compare/v4.3.0...v4.4.0
[5.0.0]: https://github.com/EndBug/add-and-commit/compare/v4.4.0...v5.0.0
[5.1.0]: https://github.com/EndBug/add-and-commit/compare/v5.0.0...v5.1.0
[5.1.1]: https://github.com/EndBug/add-and-commit/compare/v5.1.0...v5.1.1
[5.1.2]: https://github.com/EndBug/add-and-commit/compare/v5.1.1...v5.1.2
[5.2.0]: https://github.com/EndBug/add-and-commit/compare/v5.1.2...v5.2.0
[5.3.0]: https://github.com/EndBug/add-and-commit/compare/v5.2.0...v5.3.0
[6.0.0]: https://github.com/EndBug/add-and-commit/compare/v5.3.0...v6.0.0
[6.1.0]: https://github.com/EndBug/add-and-commit/compare/v6.0.0...v6.1.0
[6.2.0]: https://github.com/EndBug/add-and-commit/compare/v6.1.0...v6.2.0
[7.0.0]: https://github.com/EndBug/add-and-commit/compare/v6.2.0...v7.0.0

189
README.md
View File

@@ -1,7 +1,7 @@
# Add & Commit
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-git-master.endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DEndBug%2Fadd-and-commit%26badge%3Dtrue)](https://github.com/search?o=desc&q=EndBug+add-and-commit+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code)
[![All Contributors](https://img.shields.io/github/all-contributors/EndBug/add-and-commit)](#contributors-)
You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc....
@@ -13,7 +13,7 @@ This action lets you choose the path that you want to use when adding & committi
Add a step like this to your workflow:
```yaml
- uses: EndBug/add-and-commit@v4 # You can change this to use a specific version
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version
with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
@@ -27,58 +27,80 @@ Add a step like this to your workflow:
# Default: author of the commit that triggered the run
author_email: mail@example.com
# Name of the branch to use, if different from the one that triggered the workflow
# Default: the branch that triggered the run
branch: some-branch
# The local path to the directory where your repository is located. You should use actions/checkout first to set it up
# Default: '.'
cwd: './path/to/the/repo'
# Whether to use the --force option on `git add`, in order to bypass eventual gitignores
# Default: false
force: true
# Whether to use the --signoff option on `git commit`
# Default: false
signoff: true
# The message for the commit
# Default: 'Commit from GitHub Actions'
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: 'Your commit message'
# Name of the branch to use, if different from the one that triggered the workflow
# Default: the branch that triggered the workflow (from GITHUB_REF)
ref: 'someOtherBranch'
# The flag used on the pull strategy
# Default: '--no-rebase'
pull_strategy: '--no-rebase or --no-ff or --rebase'
# Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (see the paragraph below for more info)
# Default: true
push: false
# The arguments for the `git rm` command (see the paragraph below for more info)
# Default: ''
remove: "./dir/old_file.js"
remove: './dir/old_file.js'
# Name of the tag to add to the new commit (see the paragraph below for more info)
# Whether to use the --signoff option on `git commit` (only `true` and `false` are accepted)
# Default: false
signoff: true
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
# Default: ''
tag: "v1.0.0"
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
tag: 'v1.0.0 --force'
```
### Environment variables:
The only `env` variable required is the token for the action to run: GitHub generates one automatically, but you need to pass it through `env` to make it available to actions. You can find more about `GITHUB_TOKEN` [here](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret).
That said, you can just copy the example line and not worry about it. If you do want to use a different token you can pass that in, but I wouldn't see any possible advantage in doing so.
### Adding files:
The action adds files using a regular `git add` command, so you can put every kind of argument in the `add` option. For example, if you don't want it to use a recursive behavior: `$(find . -maxdepth 1 -name *.js)`.
The script will not stop if one of the git commands fails. E.g.: if your command shows a "fatal: pathspec 'yourFile' did not match any files" error the action will go on.
The action adds files using a regular `git add` command, so you can put every kind of argument in the `add` option. For example, if you want to force-add a file: `./path/to/file.txt --force`.
The script will not stop if one of the git commands fails. E.g.: if your command shows a "fatal: pathspec 'yourFile' did not match any files" error the action will go on.
You can also use JSON or YAML arrays (e.g. `'["first", "second"]'`, `"['first', 'second']"`) to make the action run multiple `git add` commands: the action will log how your input has been parsed. Please mind that your input still needs to be a string because of how GitHub Actions works with inputs: just write your array inside the string, the action will parse it later.
### Deleting files:
You can delete files with the `remove` option: that runs a `git rm` command that will stage the files in the given path for removal.
The script will not stop if one of the git commands fails. E.g.: if your command shows a "fatal: pathspec 'yourFile' did not match any files" error the action will go on.
You can delete files with the `remove` option: that runs a `git rm` command that will stage the files in the given path for removal. As with the `add` argument, you can use every option `git rm` allows (e.g. add `--force` to ignore `.gitignore` rules).
The script will not stop if one of the git commands fails. E.g.: if your command shows a "fatal: pathspec 'yourFile' did not match any files" error the action will go on.
You can also use JSON or YAML arrays (e.g. `'["first", "second"]'`, `"['first', 'second']"`) to make the action run multiple `git rm` commands: the action will log how your input has been parsed. Please mind that your input still needs to be a string because of how GitHub Actions works with inputs: just write your array inside the string, the action will parse it later.
### Pushing:
By default the action runs the following command: `git push origin ${branch input} --set-upstream`. You can use the `push` input to modify this behavior, here's what you can set it to:
- `true`: this is the default value, it will behave as usual.
- `false`: this prevents the action from pushing at all, no `git push` command is run.
- any other string:
The action will use your string as the arguments for the `git push` command. Please note that nothing is used other than your arguments, and the command will result in `git push ${push input}` (no remote, no branch, no `--set-upstream`, you have to include them yourself).
One way to use this is if you want to force push to a branch of your repo: you'll need to set the `push` input to, for example, `origin yourBranch --force`.
### Tagging:
You can tag commits with the `tag` option: when used, it will create a lightweight tag for the commit with the name you set as input. If not entered (or if an empty string is passed) teh action won't create any tag.
If there is already a tag with the name you entered it will be overwritten, and so the tag will be "updated".
You can use the `tag` option to enter the arguments for a `git add` command. In order for the action to isolate the tag name from the rest of the arguments, it should be the first word not preceded by an hyphen (e.g. `-a tag-name -m "some other stuff"` is ok).
### Tokens:
When pushing, the action uses the token that the local git repository has been configured with: that means that if you want to change it you'll need to do it in the steps that run before this action. For example: if you set up your repo with [`actions/checkout`](https://github.com/actions/checkout/) then you have to add the token there.
Changing the token with which the repo is configured can be useful if you want to run CI checks on the commit pushed by this action; anyway, it has to be set up outside of this action.
### Outputs:
The action provides these outputs:
- `committed`: whether the action has created a commit (`'true'` or `'false'`)
- `pushed`: whether the action has pushed to teh remote(`'true'` or `'false'`)
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
### Examples:
@@ -88,34 +110,32 @@ Do you want to lint your JavaScript files, located in the `src` folder, with ESL
name: Lint source code
on: push
jobs:
jobs:
run:
name: Lint with ESLint
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Update source code
run: eslint "src/**" --fix
- name: Install dependencies
run: npm install
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: Your Name
author_email: mail@example.com
message: "Your commit message"
add: "*.js"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update source code
run: eslint "src/**" --fix
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
author_name: Your Name
author_email: mail@example.com
message: 'Your commit message'
add: '*.js'
```
If you need to run the action on a repository that is not located in [`$GITHUB_WORKSPACE`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables), you can use the `cwd` option: the action uses a `cd` normal command, so the path should follow bash standards.
@@ -124,7 +144,7 @@ If you need to run the action on a repository that is not located in [`$GITHUB_W
name: Use a different repository directory
on: push
jobs:
jobs:
run:
name: Add a text file
runs-on: ubuntu-latest
@@ -133,20 +153,17 @@ jobs:
# If you need to, you can check out your repo to a different location
- uses: actions/checkout@v2
with:
path: "./pathToRepo/"
path: './pathToRepo/'
# You can make whatever type of change to the repo...
- run: echo "123" > ./pathToRepo/file.txt
# ...and then use the action as you would normally do, but providing the path to the repo
- uses: EndBug/add-and-commit@v4
- uses: EndBug/add-and-commit@v7
with:
message: "Add the very useful text file"
add: "*.txt"
cwd: "./pathToRepo/"
force: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: 'Add the very useful text file'
add: '*.txt --force'
cwd: './pathToRepo/'
```
## Contributors ✨
@@ -158,26 +175,40 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/EndBug"><img src="https://avatars1.githubusercontent.com/u/26386270?v=4" width="100px;" alt=""/><br /><sub><b>Federico Grandi</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=EndBug" title="Code">💻</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=EndBug" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/jactor-rises"><img src="https://avatars3.githubusercontent.com/u/14565088?v=4" width="100px;" alt=""/><br /><sub><b>Tor Egil Jacobsen</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=jactor-rises" title="Code">💻</a></td>
<td align="center"><a href="https://twitter.com/yelizariev"><img src="https://avatars0.githubusercontent.com/u/186131?v=4" width="100px;" alt=""/><br /><sub><b>Ivan Yelizariev</b></sub></a><br /><a href="#ideas-yelizariev" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/jhhughes"><img src="https://avatars2.githubusercontent.com/u/13724293?v=4" width="100px;" alt=""/><br /><sub><b>jhhughes</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Ajhhughes" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://sunengine.site"><img src="https://avatars3.githubusercontent.com/u/10674646?v=4" width="100px;" alt=""/><br /><sub><b>Дмитрий Океаний</b></sub></a><br /><a href="#ideas-DmitrijOkeanij" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/brahma-dev"><img src="https://avatars3.githubusercontent.com/u/1793295?v=4" width="100px;" alt=""/><br /><sub><b>Brahma Dev</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Abrahma-dev" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/felixlapalma"><img src="https://avatars2.githubusercontent.com/u/38389683?v=4" width="100px;" alt=""/><br /><sub><b>Felix Rojo Lapalma</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Afelixlapalma" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/EndBug"><img src="https://avatars1.githubusercontent.com/u/26386270?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Federico Grandi</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=EndBug" title="Code">💻</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=EndBug" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/jactor-rises"><img src="https://avatars3.githubusercontent.com/u/14565088?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tor Egil Jacobsen</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=jactor-rises" title="Code">💻</a></td>
<td align="center"><a href="https://twitter.com/yelizariev"><img src="https://avatars0.githubusercontent.com/u/186131?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Yelizariev</b></sub></a><br /><a href="#ideas-yelizariev" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/jhhughes"><img src="https://avatars2.githubusercontent.com/u/13724293?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jhhughes</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Ajhhughes" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://sunengine.site"><img src="https://avatars3.githubusercontent.com/u/10674646?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Дмитрий Океаний</b></sub></a><br /><a href="#ideas-DmitrijOkeanij" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/brahma-dev"><img src="https://avatars3.githubusercontent.com/u/1793295?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brahma Dev</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Abrahma-dev" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/felixlapalma"><img src="https://avatars2.githubusercontent.com/u/38389683?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Felix Rojo Lapalma</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Afelixlapalma" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center"><a href="http://robinwijnant.me"><img src="https://avatars3.githubusercontent.com/u/33033209?v=4" width="100px;" alt=""/><br /><sub><b>Robin Wijnant</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3ARobinWijnant" title="Bug reports">🐛</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=RobinWijnant" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/onilton"><img src="https://avatars2.githubusercontent.com/u/725676?v=4" width="100px;" alt=""/><br /><sub><b>Onilton Maciel</b></sub></a><br /><a href="#ideas-onilton" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/jsoref"><img src="https://avatars0.githubusercontent.com/u/2119212?v=4" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=jsoref" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/ToMe25"><img src="https://avatars1.githubusercontent.com/u/38815969?v=4" width="100px;" alt=""/><br /><sub><b>ToMe25</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=ToMe25" title="Code">💻</a> <a href="#ideas-ToMe25" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/JonasJacobsUserspace"><img src="https://avatars0.githubusercontent.com/u/59708720?v=4" width="100px;" alt=""/><br /><sub><b>JonasJacobsUserspace</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AJonasJacobsUserspace" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/pvogt09"><img src="https://avatars3.githubusercontent.com/u/50047961?v=4" width="100px;" alt=""/><br /><sub><b>pvogt09</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=pvogt09" title="Code">💻</a></td>
<td align="center"><a href="http://robinwijnant.me"><img src="https://avatars3.githubusercontent.com/u/33033209?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robin Wijnant</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3ARobinWijnant" title="Bug reports">🐛</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=RobinWijnant" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/onilton"><img src="https://avatars2.githubusercontent.com/u/725676?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Onilton Maciel</b></sub></a><br /><a href="#ideas-onilton" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/jsoref"><img src="https://avatars0.githubusercontent.com/u/2119212?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=jsoref" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/ToMe25"><img src="https://avatars1.githubusercontent.com/u/38815969?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ToMe25</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=ToMe25" title="Code">💻</a> <a href="#ideas-ToMe25" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/JonasJacobsUserspace"><img src="https://avatars0.githubusercontent.com/u/59708720?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JonasJacobsUserspace</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AJonasJacobsUserspace" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/pvogt09"><img src="https://avatars3.githubusercontent.com/u/50047961?v=4?s=100" width="100px;" alt=""/><br /><sub><b>pvogt09</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=pvogt09" title="Code">💻</a></td>
<td align="center"><a href="http://hoten.cc"><img src="https://avatars1.githubusercontent.com/u/4071474?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Connor Clark</b></sub></a><br /><a href="#ideas-connorjclark" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/Cyberbeni"><img src="https://avatars1.githubusercontent.com/u/8356175?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Benedek Kozma</b></sub></a><br /><a href="#ideas-Cyberbeni" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=Cyberbeni" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/coffeegoddd"><img src="https://avatars3.githubusercontent.com/u/43383835?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dustin Brown</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Acoffeegoddd" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/Chocrates"><img src="https://avatars1.githubusercontent.com/u/1758164?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris McIntosh</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AChocrates" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/kbsali"><img src="https://avatars0.githubusercontent.com/u/53676?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kevin Saliou</b></sub></a><br /><a href="#ideas-kbsali" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/ewjoachim"><img src="https://avatars0.githubusercontent.com/u/1457576?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joachim Jablon</b></sub></a><br /><a href="#ideas-ewjoachim" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/trallnag"><img src="https://avatars3.githubusercontent.com/u/24834206?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tim Schwenke</b></sub></a><br /><a href="#ideas-trallnag" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://www.somethingcatchy.net"><img src="https://avatars1.githubusercontent.com/u/12880806?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Possible Triangle</b></sub></a><br /><a href="#ideas-PssbleTrngle" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
<tr>
<td align="center"><a href="https://dominikschilling.de"><img src="https://avatars2.githubusercontent.com/u/617637?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dominik Schilling</b></sub></a><br /><a href="#ideas-ocean90" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=ocean90" title="Documentation">📖</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=ocean90" title="Code">💻</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

View File

@@ -5,40 +5,50 @@ inputs:
add:
description: Arguments for the git add command
required: false
default: "."
default: '.'
author_name:
description: The name of the user that will be displayed as the author of the commit
required: false
default: ${{ github.actor }}
author_email:
description: The email of the user that will be displayed as the author of the commit
required: false
default: ${{ github.actor }}@users.noreply.github.com
branch:
description: Name of the branch to use, if different from the one that triggered the workflow
required: false
cwd:
description: The directory where your repository is located. You should use actions/checkout first to set it up
required: false
default: "."
force:
description: Whether to use the force option on git add, in order to bypass eventual gitignores
required: false
default: "false"
signoff:
description: Whether to use the signoff option on git commit
required: false
default: "false"
default: '.'
message:
description: The message for the commit
required: false
default: Commit from GitHub Actions
ref:
description: Name of the branch to use, if different from the one that triggered the workflow
pull_strategy:
description: The flag used on the pull strategy
required: false
default: '--no-rebase'
push:
description: Whether to push the commit and, if any, its tags to the repo. It can also be used to set the git push arguments (more info in the README)
required: false
default: 'true'
remove:
description: Arguments for the git rm command
required: false
default: ""
tag:
description: The name of the tag to add to the new commit
signoff:
description: Whether to use the --signoff option on git commit
required: false
default: ""
tag:
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
required: false
outputs:
committed:
description: Whether the action has created a commit.
pushed:
description: Whether the action has pushed to the remote.
tagged:
description: Whether the action has created a tag.
runs:
using: node12

0
lib/.gitkeep generated
View File

94
lib/entrypoint.sh generated
View File

@@ -1,94 +0,0 @@
#!/bin/bash
set -u
echo "::group::Internal logs"
cd $INPUT_CWD
echo "Running in $PWD."
# Set up .netrc file with GitHub credentials
git_setup() {
cat <<-EOF >$HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 $HOME/.netrc
git config --global user.email "$INPUT_AUTHOR_EMAIL"
git config --global user.name "$INPUT_AUTHOR_NAME"
}
add() {
if $INPUT_FORCE; then f=-f; else f=; fi
git add $INPUT_ADD $f
}
remove() {
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
}
commit() {
if $INPUT_SIGNOFF; then signoffcmd=--signoff; else signoffcmd=; fi
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" $signoffcmd
}
tag() {
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
}
# This is needed to make the check work for untracked files
echo "Staging files..."
add
remove
echo "Checking for uncommitted changes in the git working tree..."
# This section only runs if there have been file changes
if ! git diff --cached --quiet --exit-code; then
git_setup
git fetch
# Verify if the branch needs to be created
if ! git rev-parse --verify --quiet "$INPUT_REF"; then
echo "Creating branch..."
git branch "$INPUT_REF"
fi
# Switch to branch from current workflow run
echo "Switching branch..."
git checkout "$INPUT_REF"
echo "Pulling from remote..."
git fetch && git pull
echo "Resetting files..."
git reset
echo "Adding files..."
add
echo "Removing files..."
remove
echo "Creating commit..."
commit
echo "Tagging commit..."
tag
echo "Pushing commits to repo..."
git push --set-upstream origin "$INPUT_REF"
echo "Pushing tags to repo..."
git push --set-upstream origin "$INPUT_REF" --force --tags
echo "::endgroup::"
echo "Task completed."
else
echo "::endgroup::"
echo "Working tree clean. Nothing to commit."
fi

2
lib/index.js generated

File diff suppressed because one or more lines are too long

970
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,21 @@
{
"name": "add-and-commit",
"version": "4.3.0",
"version": "7.0.0",
"description": "Add & commit files from a path directly from GitHub Actions",
"main": "lib/index.js",
"scripts": {
"build": "npm i && ncc build src/main.ts --minify --out lib",
"build": "ncc build src/main.ts --minify --out lib",
"watch": "ncc build src/main.ts --watch --out lib",
"lint": "eslint --ext .ts src",
"lint:fix": "eslint --ext .ts --fix src",
"changelog": "ts-node scripts/changelog.ts && npm i",
"test": "echo \"Error: no test specified\" && exit 1"
},
"husky": {
"hooks": {
"pre-commit": "npm run build && git add lib"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/EndBug/add-and-commit.git"
@@ -26,16 +34,24 @@
},
"homepage": "https://github.com/EndBug/add-and-commit#readme",
"dependencies": {
"@actions/core": "^1.1.3"
"@actions/core": "^1.2.6",
"js-yaml": "^4.0.0",
"simple-git": "^2.27.0"
},
"devDependencies": {
"@types/node": "^12.7.12",
"@types/shelljs": "^0.8.6",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"@zeit/ncc": "^0.21.1",
"all-contributors-cli": "^6.16.1",
"@types/js-yaml": "^4.0.0",
"@types/node": "^12.12.54",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"@vercel/ncc": "^0.26.2",
"all-contributors-cli": "^6.19.0",
"eslint": "^6.8.0",
"typescript": "^3.6.4"
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.7",
"prettier": "^2.2.1",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"yamljs": "^0.3.0"
}
}

45
scripts/changelog.ts Normal file
View File

@@ -0,0 +1,45 @@
import fs from 'fs'
import path from 'path'
const currentVersion = require('../package.json').version
if (!currentVersion) throw new Error("Cant't detect library version.")
const changelogPath = path.resolve(__dirname, '../CHANGELOG.md')
const changelog = fs.readFileSync(changelogPath, { encoding: 'utf-8' })
if (changelog.includes(`## [${currentVersion}]`))
throw new Error('Current version has already been documented.')
let futureChangelog = ''
// Add version section
let arr = changelog.split('## [Unreleased]')
arr[1] =
`
## [${currentVersion}] - ${new Date().toISOString().slice(0, 10)}
### Removed:
- **[BREAKING]** ListName: description
### Added:
-
### Fixed:
- ` + arr[1]
futureChangelog = arr.join('## [Unreleased]')
// Update footer
arr = futureChangelog.split('\n').map((line) =>
line.startsWith('[unreleased]') // The link ref is lowercase because of prettier
? `[unreleased]: https://github.com/EndBug/add-and-commit/compare/v${currentVersion}...HEAD`
: line
)
const lastVersion = ([...arr].reverse()[1]?.match(/\[([^\][]*)]/) ||
[])[0].replace(/[\[\]']+/g, '') // eslint-disable-line no-useless-escape
if (!lastVersion) throw new Error("Can't find last version in changelog.")
const lastLine = `[${currentVersion}]: https://github.com/EndBug/add-and-commit/compare/v${lastVersion}...v${currentVersion}`
if (arr[arr.length - 1] === '') arr[arr.length - 1] = lastLine
else arr.push(lastLine)
futureChangelog = arr.join('\n')
fs.writeFileSync(changelogPath, futureChangelog)

View File

@@ -1,94 +0,0 @@
#!/bin/bash
set -u
echo "::group::Internal logs"
cd $INPUT_CWD
echo "Running in $PWD."
# Set up .netrc file with GitHub credentials
git_setup() {
cat <<-EOF >$HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 $HOME/.netrc
git config --global user.email "$INPUT_AUTHOR_EMAIL"
git config --global user.name "$INPUT_AUTHOR_NAME"
}
add() {
if $INPUT_FORCE; then f=-f; else f=; fi
git add $INPUT_ADD $f
}
remove() {
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
}
commit() {
if $INPUT_SIGNOFF; then signoffcmd=--signoff; else signoffcmd=; fi
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>" $signoffcmd
}
tag() {
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
}
# This is needed to make the check work for untracked files
echo "Staging files..."
add
remove
echo "Checking for uncommitted changes in the git working tree..."
# This section only runs if there have been file changes
if ! git diff --cached --quiet --exit-code; then
git_setup
git fetch
# Verify if the branch needs to be created
if ! git rev-parse --verify --quiet "$INPUT_REF"; then
echo "Creating branch..."
git branch "$INPUT_REF"
fi
# Switch to branch from current workflow run
echo "Switching branch..."
git checkout "$INPUT_REF"
echo "Pulling from remote..."
git fetch && git pull
echo "Resetting files..."
git reset
echo "Adding files..."
add
echo "Removing files..."
remove
echo "Creating commit..."
commit
echo "Tagging commit..."
tag
echo "Pushing commits to repo..."
git push --set-upstream origin "$INPUT_REF"
echo "Pushing tags to repo..."
git push --set-upstream origin "$INPUT_REF" --force --tags
echo "::endgroup::"
echo "Task completed."
else
echo "::endgroup::"
echo "Working tree clean. Nothing to commit."
fi

View File

@@ -1,36 +1,380 @@
import { info, setFailed, getInput, warning } from '@actions/core'
import { execFile } from 'child_process'
import { join } from 'path'
import {
info,
setFailed,
warning,
debug,
startGroup,
endGroup
} from '@actions/core'
import path from 'path'
import simpleGit, { Response } from 'simple-git'
import YAML from 'js-yaml'
import { getInput, Input, log, outputs, parseBool, setOutput } from './util'
try {
checkInputs()
const child = execFile(join(__dirname, 'entrypoint.sh'), [], { shell: true })
child.stdout?.pipe(process.stdout)
child.stderr?.pipe(process.stderr)
} catch (err) {
console.error(err)
setFailed(err instanceof Error ? err.message : err)
}
const baseDir = path.join(process.cwd(), getInput('cwd') || '')
const git = simpleGit({ baseDir })
console.log(`Running in ${baseDir}`)
;(async () => {
await checkInputs().catch(setFailed)
function checkInputs() {
const eventPath = process.env.GITHUB_EVENT_PATH
const author = eventPath && require(eventPath)?.head_commit?.author
startGroup('Internal logs')
info('> Staging files...')
if (author) {
setDefault('author_name', author.name)
setDefault('author_email', author.email)
if (getInput('add')) {
info('> Adding files...')
await add()
} else info('> No files to add.')
if (getInput('remove')) {
info('> Removing files...')
await remove()
} else info('> No files to remove.')
info('> Checking for uncommitted changes in the git working tree...')
const changedFiles = (await git.diffSummary(['--cached'])).files.length
if (changedFiles > 0) {
info(`> Found ${changedFiles} changed files.`)
await git
.addConfig('user.email', getInput('author_email'), undefined, log)
.addConfig('user.name', getInput('author_name'), undefined, log)
debug(
'> Current git config\n' +
JSON.stringify((await git.listConfig()).all, null, 2)
)
await git.fetch(['--tags', '--force'], log)
info('> Switching/creating branch...')
await git
.checkout(getInput('branch'), undefined, log)
.catch(() => git.checkoutLocalBranch(getInput('branch'), log))
info('> Pulling from remote...')
await git.fetch(undefined, log).pull(
undefined,
undefined,
{
[getInput('pull_strategy')]: null
},
log
)
info('> Re-staging files...')
if (getInput('add')) await add({ ignoreErrors: true })
if (getInput('remove')) await remove({ ignoreErrors: true })
info('> Creating commit...')
await git.commit(
getInput('message'),
undefined,
{
'--author': `"${getInput('author_name')} <${getInput(
'author_email'
)}>"`,
...(getInput('signoff')
? {
'--signoff': null
}
: {})
},
(err, data?) => {
if (data) setOutput('committed', 'true')
return log(err, data)
}
)
if (getInput('tag')) {
info('> Tagging commit...')
await git
.tag(getInput('tag').split(' '), (err, data?) => {
if (data) setOutput('tagged', 'true')
return log(err, data)
})
.then((data) => {
setOutput('tagged', 'true')
return log(null, data)
})
.catch((err) => setFailed(err))
} else info('> No tag info provided.')
const pushOption = parseBool(getInput('push')) ?? getInput('push')
if (pushOption) {
// If the options is `true | string`...
info('> Pushing commit to repo...')
if (pushOption === true) {
debug(`Running: git push origin ${getInput('branch')} --set-upstream`)
await git.push(
'origin',
getInput('branch'),
{ '--set-upstream': null },
(err, data?) => {
if (data) setOutput('pushed', 'true')
return log(err, data)
}
)
} else {
debug(`Running: git push ${pushOption}`)
await git.push(
undefined,
undefined,
pushOption.split(' '),
(err, data?) => {
if (data) setOutput('pushed', 'true')
return log(err, data)
}
)
}
if (getInput('tag')) {
info('> Pushing tags to repo...')
await git
.pushTags('origin', undefined, (e, d?) => log(undefined, e || d))
.catch(() => {
info('> Tag push failed: deleting remote tag and re-pushing...')
return git
.push(
undefined,
undefined,
{
'--delete': null,
origin: null,
[getInput('tag')
.split(' ')
.filter((w) => !w.startsWith('-'))[0]]: null
},
log
)
.pushTags('origin', undefined, log)
})
} else info('> No tags to push.')
} else info('> Not pushing anything.')
endGroup()
info('> Task completed.')
} else {
if (!getInput('author_name') || !getInput('author_email')) warning(`Unable to fetch author info: couldn't find ${!eventPath ? 'event path' : !require(eventPath)?.head_commit ? 'commit' : 'commit author'}.`)
setDefault('author_name', 'Add & Commit Action')
setDefault('author_email', 'actions@github.com')
endGroup()
info('> Working tree clean. Nothing to commit.')
}
})()
.then(logOutputs)
.catch((e) => {
endGroup()
logOutputs()
setFailed(e)
})
async function checkInputs() {
function setInput(input: Input, value: string | undefined) {
if (value) return (process.env[`INPUT_${input.toUpperCase()}`] = value)
else return delete process.env[`INPUT_${input.toUpperCase()}`]
}
function setDefault(input: Input, value: string) {
if (!getInput(input)) setInput(input, value)
return getInput(input)
}
setDefault('ref', process.env.GITHUB_REF?.substring(11) || '')
const eventPath = process.env.GITHUB_EVENT_PATH,
event = eventPath && require(eventPath),
isPR = process.env.GITHUB_EVENT_NAME?.includes('pull_request'),
defaultBranch = isPR
? (event?.pull_request?.head?.ref as string)
: process.env.GITHUB_REF?.substring(11)
info(`Using '${getInput('author_name')} <${getInput('author_email')}>' as author.`)
// #region add, remove
if (!getInput('add') && !getInput('remove'))
throw new Error(
"Both 'add' and 'remove' are empty, the action has nothing to do."
)
if (getInput('add')) {
const parsed = parseInputArray(getInput('add'))
if (parsed.length == 1)
info('Add input parsed as single string, running 1 git add command.')
else if (parsed.length > 1)
info(
`Add input parsed as string array, running ${parsed.length} git add commands.`
)
else setFailed('Add input: array length < 1')
}
if (getInput('remove')) {
const parsed = parseInputArray(getInput('remove'))
if (parsed.length == 1)
info('Remove input parsed as single string, running 1 git rm command.')
else if (parsed.length > 1)
info(
`Remove input parsed as string array, running ${parsed.length} git rm commands.`
)
else setFailed('Remove input: array length < 1')
}
// #endregion
// #region author_name, author_email
setDefault('author_name', `${process.env.GITHUB_ACTOR}`)
setDefault(
'author_email',
`${process.env.GITHUB_ACTOR}@users.noreply.github.com`
)
info(
`> Using '${getInput('author_name')} <${getInput(
'author_email'
)}>' as author.`
)
// #endregion
// #region message
setDefault(
'message',
`Commit from GitHub Actions (${process.env.GITHUB_WORKFLOW})`
)
info(`> Using "${getInput('message')}" as commit message.`)
// #endregion
// #region branch
const branch = setDefault('branch', defaultBranch || '')
if (isPR) info(`> Running for a PR, the action will use '${branch}' as ref.`)
// #endregion
// #region signoff
if (getInput('signoff')) {
const parsed = parseBool(getInput('signoff'))
if (parsed === undefined)
throw new Error(
`"${getInput(
'signoff'
)}" is not a valid value for the 'signoff' input: only "true" and "false" are allowed.`
)
if (!parsed) setInput('signoff', undefined)
debug(
`Current signoff option: ${getInput('signoff')} (${typeof getInput(
'signoff'
)})`
)
}
// #endregion
// #region push
if (getInput('push')) {
// It has to be either 'true', 'false', or any other string (use as arguments)
const parsed = parseBool(getInput('push'))
debug(
`Current push option: '${getInput('push')}' (parsed as ${typeof parsed})`
)
}
// #endregion
}
function setDefault(input: string, value: string) {
const key = 'INPUT_' + input.toUpperCase()
if (!process.env[key]) process.env[key] = value
async function add({ logWarning = true, ignoreErrors = false } = {}): Promise<
(void | Response<void>)[]
> {
const input = getInput('add')
if (!input) return []
const parsed = parseInputArray(input)
const res: (void | Response<void>)[] = []
for (const args of parsed) {
res.push(
// Push the result of every git command (which are executed in order) to the array
// If any of them fails, the whole function will return a Promise rejection
await git
.add(args.split(' '), (err: any, data?: any) =>
log(ignoreErrors ? null : err, data)
)
.catch((e: Error) => {
if (ignoreErrors) return
if (
e.message.includes('fatal: pathspec') &&
e.message.includes('did not match any files') &&
logWarning
)
warning(`Add command did not match any file:\n git add ${args}`)
else throw e
})
)
}
return res
}
async function remove({
logWarning = true,
ignoreErrors = false
} = {}): Promise<(void | Response<void>)[]> {
const input = getInput('remove')
if (!input) return []
const parsed = parseInputArray(input)
const res: (void | Response<void>)[] = []
for (const args of parsed) {
res.push(
// Push the result of every git command (which are executed in order) to the array
// If any of them fails, the whole function will return a Promise rejection
await git
.rm(args.split(' '), (e: any, d?: any) =>
log(ignoreErrors ? null : e, d)
)
.catch((e: Error) => {
if (ignoreErrors) return
if (
e.message.includes('fatal: pathspec') &&
e.message.includes('did not match any files')
)
logWarning &&
warning(
`Remove command did not match any file:\n git rm ${args}`
)
else throw e
})
)
}
return res
}
/**
* Tries to parse a JSON array, then a YAML array.
* If both fail, it returns an array containing the input value as its only element
*/
function parseInputArray(input: string): string[] {
try {
const json = JSON.parse(input)
if (
json &&
Array.isArray(json) &&
json.every((e) => typeof e == 'string')
) {
debug(`Input parsed as JSON array of length ${json.length}`)
return json
}
} catch {}
try {
const yaml = YAML.load(input)
if (
yaml &&
Array.isArray(yaml) &&
yaml.every((e) => typeof e == 'string')
) {
debug(`Input parsed as YAML array of length ${yaml.length}`)
return yaml
}
} catch {}
debug('Input parsed as single string')
return [input]
}
function logOutputs() {
startGroup('Outputs')
for (const key in outputs) {
info(`${key}: ${outputs[key]}`)
}
endGroup()
}

44
src/util.ts Normal file
View File

@@ -0,0 +1,44 @@
import * as core from '@actions/core'
export type Input =
| 'add'
| 'author_name'
| 'author_email'
| 'branch'
| 'cwd'
| 'message'
| 'pull_strategy'
| 'push'
| 'remove'
| 'signoff'
| 'tag'
export const outputs = {
committed: 'false',
pushed: 'false',
tagged: 'false'
}
export type Output = keyof typeof outputs
export function getInput(name: Input) {
return core.getInput(name)
}
export function log(err: any | Error, data?: any) {
if (data) console.log(data)
if (err) core.error(err)
}
export function parseBool(value: any) {
try {
const parsed = JSON.parse(value)
if (typeof parsed == 'boolean') return parsed
} catch {}
}
export function setOutput(name: Output, value: 'true' | 'false') {
core.debug(`Setting output: ${name}=${value}`)
outputs[name] = value
return core.setOutput(name, value)
}
for (const key in outputs) setOutput(key as Output, outputs[key])

View File

@@ -56,6 +56,7 @@
},
"exclude": [
"node_modules",
"**/*.test.ts"
"**/*.test.ts",
"scripts"
]
}