Compare commits

...

205 Commits

Author SHA1 Message Date
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
Federico Grandi
d5f44e7aeb release: v4.3.0 2020-07-29 19:07:42 +02:00
allcontributors[bot]
52f10712cb docs: add pvogt09 as a contributor (#47)
* 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-29 19:05:50 +02:00
pvogt09
51fc21c221 add option to use --signoff with git commit (#46)
* adds option to use --signoff with git commit

Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>

* [auto] build: update compiled version

* fix: remove quotes and refactor

* [auto] build: update compiled version

Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
2020-07-29 19:04:48 +02:00
Federico Grandi
46b61e173e release: v4.2.1 2020-07-10 20:03:38 +02:00
Federico Grandi
06d54462fa Merge pull request #44 from EndBug/all-contributors/add-JonasJacobsUserspace
docs: add JonasJacobsUserspace as a contributor
2020-07-10 17:27:46 +02:00
allcontributors[bot]
21a36873cf docs: update .all-contributorsrc [skip ci] 2020-07-10 15:27:32 +00:00
allcontributors[bot]
4d2a782ca7 docs: update README.md [skip ci] 2020-07-10 15:27:31 +00:00
Federico Grandi
feb7bba5df Merge pull request #43 from EndBug/all-contributors/add-ToMe25
docs: add ToMe25 as a contributor
2020-07-10 17:23:01 +02:00
allcontributors[bot]
30fd5a24e7 docs: update .all-contributorsrc [skip ci] 2020-07-10 15:22:37 +00:00
allcontributors[bot]
4f4dea335c docs: update README.md [skip ci] 2020-07-10 15:22:36 +00:00
Federico Grandi
caecee358e Merge pull request #42 from EndBug/all-contributors/add-jsoref
docs: add jsoref as a contributor
2020-07-10 17:21:25 +02:00
allcontributors[bot]
79fc4adbf9 docs: update .all-contributorsrc [skip ci] 2020-07-10 15:21:12 +00:00
allcontributors[bot]
4fe29d7392 docs: update README.md [skip ci] 2020-07-10 15:21:11 +00:00
Federico Grandi
2b94f96e3e docs: re-generate contributors 2020-07-10 17:19:43 +02:00
Federico Grandi
ab8370c244 Merge pull request #37 from EndBug/all-contributors/add-DmitrijOkeanij
docs: add DmitrijOkeanij as a contributor
2020-07-10 17:18:53 +02:00
Federico Grandi
61eda586c3 Merge branch 'master' into all-contributors/add-DmitrijOkeanij 2020-07-10 17:18:35 +02:00
Federico Grandi
b34850c645 Merge pull request #41 from EndBug/all-contributors/add-onilton
docs: add onilton as a contributor
2020-07-10 17:16:13 +02:00
allcontributors[bot]
f0718670ec docs: update .all-contributorsrc [skip ci] 2020-07-10 15:15:24 +00:00
allcontributors[bot]
ce9997b52f docs: update README.md [skip ci] 2020-07-10 15:15:23 +00:00
Federico Grandi
8cb387e3de Merge pull request #40 from EndBug/all-contributors/add-RobinWijnant
docs: add RobinWijnant as a contributor
2020-07-10 17:14:43 +02:00
allcontributors[bot]
4d0876f6b0 docs: update .all-contributorsrc [skip ci] 2020-07-10 15:14:11 +00:00
allcontributors[bot]
34cf82b848 docs: update README.md [skip ci] 2020-07-10 15:14:10 +00:00
Federico Grandi
8cc88cd3ac fix(contributors): fix malformed JSON 2020-07-10 17:13:43 +02:00
Federico Grandi
c94b5af098 Merge pull request #39 from EndBug/all-contributors/add-felixlapalma
docs: add felixlapalma as a contributor
2020-07-10 17:10:50 +02:00
Federico Grandi
d992c49843 Merge branch 'master' into all-contributors/add-felixlapalma 2020-07-10 17:10:39 +02:00
Federico Grandi
8a80768baa Merge pull request #38 from EndBug/all-contributors/add-brahma-dev
docs: add brahma-dev as a contributor
2020-07-10 17:06:24 +02:00
allcontributors[bot]
8b941d4dfd docs: update .all-contributorsrc [skip ci] 2020-07-10 15:05:53 +00:00
allcontributors[bot]
d5de9f3f0d docs: update README.md [skip ci] 2020-07-10 15:05:52 +00:00
allcontributors[bot]
2d9c41ae6b docs: update .all-contributorsrc [skip ci] 2020-07-10 15:05:03 +00:00
allcontributors[bot]
5560eecdc1 docs: update README.md [skip ci] 2020-07-10 15:05:02 +00:00
allcontributors[bot]
58530b3799 docs: update .all-contributorsrc [skip ci] 2020-07-10 15:03:49 +00:00
allcontributors[bot]
026e98aa42 docs: update README.md [skip ci] 2020-07-10 15:03:48 +00:00
Federico Grandi
c2e2293f44 Merge pull request #36 from EndBug/all-contributors/add-jhhughes
docs: add jhhughes as a contributor
2020-07-10 17:03:07 +02:00
allcontributors[bot]
08fe1b6e43 docs: update .all-contributorsrc [skip ci] 2020-07-10 15:02:16 +00:00
allcontributors[bot]
46d77cfa2d docs: update README.md [skip ci] 2020-07-10 15:02:15 +00:00
Federico Grandi
8feda109a1 Merge pull request #35 from EndBug/all-contributors/add-yelizariev
docs: add yelizariev as a contributor
2020-07-10 17:01:05 +02:00
allcontributors[bot]
7e9ca065e6 docs: update .all-contributorsrc [skip ci] 2020-07-10 14:59:36 +00:00
allcontributors[bot]
7acf8aea7c docs: update README.md [skip ci] 2020-07-10 14:59:35 +00:00
Federico Grandi
30fab2fa31 Merge pull request #34 from EndBug/all-contributors/add-jactor-rises
docs: add jactor-rises as a contributor
2020-07-10 16:56:30 +02:00
allcontributors[bot]
cbdf3e43f1 docs: update .all-contributorsrc [skip ci] 2020-07-10 14:55:06 +00:00
allcontributors[bot]
507713a63b docs: update README.md [skip ci] 2020-07-10 14:55:04 +00:00
Federico Grandi
c512c446c5 chore: update commit message 2020-07-10 16:51:32 +02:00
Federico Grandi
3067c9e15c docs: add @EndBug as a contributor 2020-07-10 16:50:22 +02:00
Federico Grandi
85ed07244a docs(contributors): add all-contributors 2020-07-10 16:50:14 +02:00
Federico Grandi
13550b50b0 [auto] Update compiled version 2020-07-08 14:43:47 +00:00
Federico Grandi
bf3210f533 try join instead of resolve 2020-07-08 16:42:53 +02:00
Federico Grandi
6411f389b7 [auto] Update compiled version 2020-07-08 14:40:10 +00:00
Federico Grandi
dec54c038c try using shell parameter 2020-07-08 16:37:42 +02:00
Federico Grandi
e109cd1639 [auto] Update compiled version 2020-07-08 14:11:22 +00:00
Federico Grandi
ac2b74d9d0 fix:use resolve instead of join 2020-07-08 16:10:51 +02:00
Federico Grandi
d82f4d33b7 Lock to v1 (safer) 2020-05-17 18:36:51 +02:00
Federico Grandi
d926d1c554 [auto] Update compiled version 2020-05-17 16:26:50 +00:00
Federico Grandi
8b797ba126 Fix tag clobbering 2020-05-17 18:26:13 +02:00
Federico Grandi
1b11953688 Bump version: 4.2.0 2020-05-17 18:18:56 +02:00
Federico Grandi
36bc3f778b Improve tagging docs 2020-05-17 18:17:30 +02:00
Federico Grandi
c61b317dea Merge pull request #30 from ToMe25/master
Add tagging support
2020-05-17 18:12:19 +02:00
ToMe25
22cdfa345a [auto] Update compiled version 2020-05-16 17:54:55 +00:00
ToMe25
d4aeb9335d Hopefully this time fix which commit gets tagged 2020-05-16 19:54:18 +02:00
ToMe25
46569f991f [auto] Update compiled version 2020-05-16 17:45:45 +00:00
ToMe25
83761c7e8e Hopefully fix wrong commit getting tagged 2020-05-16 19:44:48 +02:00
ToMe25
f0a1d2598a [auto] Update compiled version 2020-05-16 17:17:36 +00:00
ToMe25
c902408157 Add missing push arg 2020-05-16 19:16:43 +02:00
ToMe25
6b705fa3a4 Add tagging support 2020-05-16 18:30:49 +02:00
Federico Grandi
0e98be578d Version bump: 4.1.0 2020-05-01 15:36:30 +02:00
Federico Grandi
c07603c1c4 [auto] Update compiled version 2020-05-01 13:28:50 +00:00
Federico Grandi
9cd6e9c0ea Add ref option 2020-05-01 15:27:44 +02:00
Federico Grandi
5bf921b386 Version bump: 4.0.3 2020-05-01 11:52:28 +02:00
Federico Grandi
beedcea439 Version bump: 4.0.2 2020-05-01 11:48:19 +02:00
Federico Grandi
6cb111a771 [auto] Update compiled version 2020-05-01 09:47:36 +00:00
Federico Grandi
6a4387c9c9 Minor log improvement 2020-05-01 11:46:57 +02:00
Federico Grandi
132aa0f637 [auto] Update compiled version 2020-05-01 09:42:54 +00:00
Federico Grandi
7dbb54bce3 Add groups 2020-05-01 11:42:13 +02:00
Federico Grandi
7f1289bf4a Pipe stderr too 2020-05-01 11:39:32 +02:00
Federico Grandi
88d475f304 [auto] Update compiled version 2020-05-01 09:35:49 +00:00
Federico Grandi
98f4b8018b Try with .pipe 2020-05-01 11:35:06 +02:00
Federico Grandi
2f6a78549b [auto] Update compiled version 2020-05-01 09:26:43 +00:00
Federico Grandi
9cd727829f Try using execFile 2020-05-01 11:26:05 +02:00
Federico Grandi
f0fcdb07a3 [auto] Update compiled version 2020-05-01 09:17:33 +00:00
Federico Grandi
5ead79aef9 Try to fix logs 2020-05-01 11:16:32 +02:00
Federico Grandi
72da43cf1b Merge pull request #28 from RobinWijnant/master
Add --quiet flag to git diff
2020-05-01 11:08:07 +02:00
Robin Wijnant
9eb0d21b0d add --quiet flag git diff
This fixes ENOBUFS error which is thrown when the stdout buffer exceeds 1MB
2020-04-30 10:31:44 +02:00
Federico Grandi
2db75722ce Merge pull request #26 from jsoref/grammar
Improve grammar and formatting in README
2020-04-27 16:07:53 +02:00
Josh Soref
68d0f64f6f Grammar 2020-04-26 18:23:22 -04:00
Federico Grandi
d1cfc165c7 [auto] Update compiled version 2020-04-19 17:48:30 +00:00
Federico Grandi
5f12f937cb Fix error hadling
Ref #25
2020-04-19 19:47:38 +02:00
Federico Grandi
2d77fa2c79 Bump version 2020-03-20 16:49:50 +01:00
Federico Grandi
f6b13bc7e9 [auto] Update compiled version 2020-03-20 15:37:19 +00:00
Federico Grandi
116c918fd3 Warn only if one of the params is missing 2020-03-20 16:36:34 +01:00
Federico Grandi
fbbcae9aa5 [auto] Update compiled version 2020-03-20 14:12:28 +00:00
Federico Grandi
7bd2b1ca10 Fix: allow action to work without head_commit
Ref: Issue #22
2020-03-20 15:11:47 +01:00
Federico Grandi
61d14d1bee Merge pull request #24 from EndBug/ncc
Use @zeit/ncc for builds
2020-03-20 14:54:36 +01:00
Federico Grandi
6a75638ec3 Update lib file name 2020-03-20 14:51:31 +01:00
Federico Grandi
ff38b6c4a6 [auto] Update compiled version 2020-03-20 13:48:59 +00:00
Federico Grandi
e67ce7f439 Use @zeit/ncc for builds 2020-03-20 14:48:20 +01:00
Federico Grandi
a83118880c Use child_process instead of shelljs 2020-03-20 14:47:36 +01:00
Federico Grandi
a28158a63f Fix CVE-2020-7598 2020-03-20 13:03:43 +01:00
dependabot[bot]
30030e85c0 Bump acorn from 7.1.0 to 7.1.1 (#21)
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-14 15:21:39 +01:00
Federico Grandi
79fa1f9f98 Use add-and-commit@v4.0.0 2020-03-03 19:42:01 +01:00
Federico Grandi
06fd39b8b7 Fix typo 2020-03-03 19:31:46 +01:00
Federico Grandi
f278ec6d47 Trigger workflow run 2020-03-03 19:30:13 +01:00
Federico Grandi
5a3f4c1c24 Update build workflow 2020-03-03 19:29:21 +01:00
Federico Grandi
602bf4ea71 Final adjustments for v4 2020-03-03 19:28:06 +01:00
Federico Grandi
5148cf0f38 Use set -u instead of -eu 2020-03-03 19:04:22 +01:00
Federico Grandi
12febc42d8 Use git add 2020-03-03 18:36:41 +01:00
Federico Grandi
de8a121ebd Rm (#20)
* Add remove option

* [auto] Update compiled version

* Add fixes

* [auto] Update compiled version

* Update docs
2020-02-21 16:48:19 +01:00
Federico Grandi
a2b49385e8 [auto] Update compiled version 2020-02-11 20:31:49 +00:00
Federico Grandi
ea7cddff4f Better usage docs 2020-02-03 17:12:00 +01:00
Federico Grandi
9acdb7d7f4 Small refactor 2020-02-03 16:54:41 +01:00
Federico Grandi
6d08b4f153 Add setDefault function 2020-02-03 16:53:01 +01:00
Federico Grandi
925751a406 Update versioning.yml 2020-01-24 10:52:35 +01:00
Federico Grandi
d3ccc660f4 Fix typos 2020-01-22 21:31:06 +01:00
Federico Grandi
4d5fbad9c9 Add pull command 2020-01-22 21:18:55 +01:00
Federico Grandi
aa1a8cef82 Add cwd option (#15)
* Add cwd option

* Commit dist files

* Debugging

* Remove modules

* Update docs

* Remove debugging command

* Minor formatting change
2019-12-29 20:19:06 +01:00
Federico Grandi
df80e1746f Update build.yml 2019-12-24 10:52:12 +01:00
Federico Grandi
e6702dc457 Update build.yml 2019-12-24 10:51:16 +01:00
Federico Grandi
08a333fd51 Remove build from dist script 2019-12-20 22:48:26 +01:00
Federico Grandi
570c13708e Fix dependencies 2019-12-20 22:28:48 +01:00
Federico Grandi
6354828f7b Add linting & edit scripts 2019-12-20 22:25:36 +01:00
Federico Grandi
5f0bbb3e99 Remove latest-tag 2019-12-20 22:20:33 +01:00
Federico Grandi
a32c180667 Minor improvements 2019-12-20 22:19:31 +01:00
Federico Grandi
5ba43bd1de Update docs 2019-12-20 22:17:58 +01:00
Federico Grandi
514b397571 Use actions-tagger 2019-12-20 22:17:37 +01:00
Federico Grandi
0a723093dc Delete build-release.yml 2019-12-14 23:36:50 +01:00
Federico Grandi
f85bf9b85e Last test with auto-building dist branch 2019-12-14 23:29:49 +01:00
Federico Grandi
2096009ef6 Bump version 2019-12-14 23:25:20 +01:00
Federico Grandi
8063b07a5a Edit workflows 2019-12-14 23:14:32 +01:00
Federico Grandi
dd4d657304 Back to manual pushing for releases 2019-12-14 23:10:48 +01:00
Federico Grandi
983180c6c6 Speed up the whole thing 2019-12-14 23:04:14 +01:00
Federico Grandi
aecfd6262a Update workflow to use self-compilation 2019-12-14 22:52:07 +01:00
Federico Grandi
b5a17167bf [auto] Update compiled version 2019-12-14 21:29:45 +00:00
Federico Grandi
c3549913c6 Implement changes of v2.2.0 2019-12-14 22:28:47 +01:00
Federico Grandi
b4fc1efdd2 Delete entrypoint.sh 2019-12-14 22:07:32 +01:00
Federico Grandi
01b3042145 Update workflows 2019-12-14 22:02:25 +01:00
Federico Grandi
e5272e4c09 Remove modules from source 2019-12-14 21:58:11 +01:00
Federico Grandi
f118062594 Update with working working version (#12)
* Fix workflow

* Trigger

* [auto] Update compiled version

* [auto] Commit modules

* Push Windows changes

* Fix

* [auto] Update compiled version

* Try removing cwd

* [auto] Update compiled version

* Try with path module

* [auto] Update compiled version

* Fix path

* [auto] Update compiled version

* Use raw path

* [auto] Update compiled version

* Other path

* [auto] Update compiled version

* Avoid @action/exec

* [auto] Update compiled version

* test

* [auto] Update compiled version

* test

* [auto] Update compiled version

* test

* [auto] Update compiled version

* test

* [auto] Update compiled version

* Try with shelljs

* [auto] Update compiled version

* Fix my stupidity

* Copy scripts to local dir

* [auto] Update compiled version

* Still use path

* [auto] Update compiled version

* Delete entrypoint.sh

* [auto] Update compiled version

* Make file executable

* [auto] Update compiled version

* Try using bash

* [auto] Update compiled version
2019-12-14 21:47:13 +01:00
Federico Grandi
d81e04e96c [auto] Update compiled version 2019-12-10 20:10:39 +00:00
Federico Grandi
33d0a0858a Fix workflows 2019-12-10 21:09:49 +01:00
Federico Grandi
5277b29cf2 Add build workflows 2019-12-10 21:00:28 +01:00
Federico Grandi
463ebc38cb Update gitignore 2019-12-10 20:51:12 +01:00
Federico Grandi
b99985e9be Add lib directory 2019-12-10 20:50:52 +01:00
Federico Grandi
bfb772f923 Move from Docker to TS/Node 2019-12-10 20:50:40 +01:00
Federico Grandi
b1b499b985 Add node package files
Ignore node_modules folder
2019-12-10 20:49:57 +01:00
Federico Grandi
7a1f5ecb56 Fix version in docs 2019-12-07 20:53:12 +01:00
Federico Grandi
6d22917a33 Bump version in docs 2019-12-07 20:52:18 +01:00
Federico Grandi
cf96c454b6 Fix branch conflicts (#7)
* Add branch check

* Improve docs
2019-12-07 20:50:05 +01:00
26 changed files with 3156 additions and 145 deletions

181
.all-contributorsrc Normal file
View File

@@ -0,0 +1,181 @@
{
"projectName": "add-and-commit",
"projectOwner": "EndBug",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"commitConvention": "angular",
"contributors": [
{
"login": "EndBug",
"name": "Federico Grandi",
"avatar_url": "https://avatars1.githubusercontent.com/u/26386270?v=4",
"profile": "https://github.com/EndBug",
"contributions": [
"code",
"doc"
]
},
{
"login": "jactor-rises",
"name": "Tor Egil Jacobsen",
"avatar_url": "https://avatars3.githubusercontent.com/u/14565088?v=4",
"profile": "https://github.com/jactor-rises",
"contributions": [
"code"
]
},
{
"login": "yelizariev",
"name": "Ivan Yelizariev",
"avatar_url": "https://avatars0.githubusercontent.com/u/186131?v=4",
"profile": "https://twitter.com/yelizariev",
"contributions": [
"ideas"
]
},
{
"login": "jhhughes",
"name": "jhhughes",
"avatar_url": "https://avatars2.githubusercontent.com/u/13724293?v=4",
"profile": "https://github.com/jhhughes",
"contributions": [
"bug"
]
},
{
"login": "DmitrijOkeanij",
"name": "Дмитрий Океаний",
"avatar_url": "https://avatars3.githubusercontent.com/u/10674646?v=4",
"profile": "https://sunengine.site",
"contributions": [
"ideas"
]
},
{
"login": "brahma-dev",
"name": "Brahma Dev",
"avatar_url": "https://avatars3.githubusercontent.com/u/1793295?v=4",
"profile": "https://github.com/brahma-dev",
"contributions": [
"bug"
]
},
{
"login": "felixlapalma",
"name": "Felix Rojo Lapalma",
"avatar_url": "https://avatars2.githubusercontent.com/u/38389683?v=4",
"profile": "https://github.com/felixlapalma",
"contributions": [
"bug"
]
},
{
"login": "RobinWijnant",
"name": "Robin Wijnant",
"avatar_url": "https://avatars3.githubusercontent.com/u/33033209?v=4",
"profile": "http://robinwijnant.me",
"contributions": [
"bug",
"code"
]
},
{
"login": "onilton",
"name": "Onilton Maciel",
"avatar_url": "https://avatars2.githubusercontent.com/u/725676?v=4",
"profile": "https://github.com/onilton",
"contributions": [
"ideas"
]
},
{
"login": "jsoref",
"name": "Josh Soref",
"avatar_url": "https://avatars0.githubusercontent.com/u/2119212?v=4",
"profile": "https://github.com/jsoref",
"contributions": [
"doc"
]
},
{
"login": "ToMe25",
"name": "ToMe25",
"avatar_url": "https://avatars1.githubusercontent.com/u/38815969?v=4",
"profile": "https://github.com/ToMe25",
"contributions": [
"code",
"ideas"
]
},
{
"login": "JonasJacobsUserspace",
"name": "JonasJacobsUserspace",
"avatar_url": "https://avatars0.githubusercontent.com/u/59708720?v=4",
"profile": "https://github.com/JonasJacobsUserspace",
"contributions": [
"bug"
]
},
{
"login": "pvogt09",
"name": "pvogt09",
"avatar_url": "https://avatars3.githubusercontent.com/u/50047961?v=4",
"profile": "https://github.com/pvogt09",
"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"
]
},
{
"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"
]
}
],
"contributorsPerLine": 7,
"skipCi": true
}

64
.eslintrc Normal file
View File

@@ -0,0 +1,64 @@
{
"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": 0,
"@typescript-eslint/no-unused-vars": "warn",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-console": "off",
"prefer-const": [
"warn",
{
"destructuring": "all"
}
],
"quotes": [
"warn",
"single"
],
"semi": [
"warn",
"never"
],
"spaced-comment": "warn"
}
}

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']

36
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Build
on:
push:
paths:
- src/**
- .github/workflows/build.yml
workflow_dispatch:
jobs:
build:
name: Build compiled JS version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: npm run build
- uses: EndBug/add-and-commit@v4
with:
message: '[auto] build: update compiled version'
add: lib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: EndBug/add-and-commit@v4
with:
message: '[auto] build: update input typings'
add: src/inputs.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

29
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Docs
on:
push:
paths:
- .all-contributorsrc
- .github/workflows/docs.yml
workflow_dispatch:
jobs:
contributors:
name: Update contributors badge
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install
- run: npm run all-contributors-badge
- uses: EndBug/add-and-commit@v4.0.0
with:
message: "[auto] docs: update contributors badge"
add: README.md
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

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

@@ -0,0 +1,17 @@
name: Sync labels
on:
push:
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'

View File

@@ -1,18 +0,0 @@
name: Add latest tag to new release
on:
release:
types: [published]
jobs:
run:
name: Add/update tag to new release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Run latest-tag
uses: EndBug/latest-tag@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

15
.github/workflows/versioning.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Keep the versions up-to-date
on:
release:
types: [published, edited]
jobs:
actions-tagger:
runs-on: windows-latest
steps:
- uses: Actions-R-Us/actions-tagger@v1
with:
publish_latest: true
env:
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules
build

151
CHANGELOG.md Normal file
View File

@@ -0,0 +1,151 @@
# 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]
## [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/v5.2.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

View File

@@ -1,14 +0,0 @@
FROM alpine/git:1.0.7
LABEL "com.github.actions.name"="Add & Commit"
LABEL "com.github.actions.description"="Add & commit files from a path directly from GitHub Actions"
LABEL "com.github.actions.icon"="git-commit"
LABEL "com.github.actions.color"="black"
LABEL "repository"="https://github.com/EndBug/add-and-commit"
LABEL "homepage"="https://github.com/EndBug/add-and-commit"
LABEL "maintainer"="Federico Grandi <fgrandi30@gmail.com>"
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]

170
README.md
View File

@@ -1,45 +1,90 @@
# Add & Commit
<a href="https://github.com/search?o=desc&q=EndBug%2Fadd-and-commit+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code" target="_blank" title="Public workflows that use this action."><img src="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" alt="Public workflows that use this action."></a>
[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat)](#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 and so on...
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....
This is **heavily** inspired by [git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) (by [Stefan Zweifel](https://github.com/stefanzweifel)): that action automatically detects changed files and commits them. While this is useful for most situations, this doesn't commit untracked files and can sometimes commit unintended changes (such as `package-lock.json` or similar, that may have happened during previous steps).
This action lets you choose the path that you want to use when adding & committing changes, so that it works as you would normally do using `git` on your machine.
This action lets you choose the path that you want to use when adding & committing changes so that it works as you would normally do using `git` on your machine.
## Usage
Add a step like this to your workflow:
```yaml
- name: Commit changes # This is the step name that will be displayed in your runs
uses: EndBug/add-and-commit@v2.1.0 # You can change this to use a specific version
with: # See more info about inputs below
- uses: EndBug/add-and-commit@v5 # 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: '.'
add: 'src'
# The name of the user that will be displayed as the author of the commit
# Default: author of the commit that triggered the run
author_name: Your Name
# The email of the user that will be displayed as the author of the commit
# Default: author of the commit that triggered the run
author_email: mail@example.com
message: "Your commit message"
path: "."
pattern: "*.js"
force: false
# 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'
# The message for the commit
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: 'Your commit message'
# 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 (only `true` and `false` are accepted)
# Default: true
push: false
# The arguments for the `git rm` command (see the paragraph below for more info)
# Default: ''
remove: "./dir/old_file.js"
# 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 --force"
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
```
### Inputs:
- `author_name` : the name of the user that will be displayed as the author of the commit
- `author_email` : the email of the user that will be displayed as the author of the commit
- `message` : the message for the commit
- `path` : the path(s) to stage files from
- `pattern` : the pattern that matches file names
- `force` : whether to use the force option on git add, in order to bypass eventual gitignores
### 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).
With that said, you can just copy the example line and don't 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.
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.
### Example:
### Adding files:
You want to lint your JavaScript files, located in the `src` folder, with ESLint so that fixable changes are done without your intervention. You can use a workflow like this:
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.
### 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. 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.
### Tagging:
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).
### Examples:
Do you want to lint your JavaScript files, located in the `src` folder, with ESLint, so that fixable changes are done without your intervention? You can use a workflow like this:
```yaml
name: Lint source code
@@ -51,12 +96,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@master
uses: actions/setup-node@v1
with:
node-version: 10.0.0
node-version: 12.x
- name: Install dependencies
run: npm install
@@ -65,17 +110,86 @@ jobs:
run: eslint "src/**" --fix
- name: Commit changes
uses: EndBug/add-and-commit@v2.1.0
uses: EndBug/add-and-commit@v5
with:
author_name: Your Name
author_email: mail@example.com
message: "Your commit message"
path: "."
pattern: "*.js"
add: "*.js"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
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.
```yaml
name: Use a different repository directory
on: push
jobs:
run:
name: Add a text file
runs-on: ubuntu-latest
steps:
# If you need to, you can check out your repo to a different location
- uses: actions/checkout@v2
with:
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@v5
with:
message: "Add the very useful text file"
add: "*.txt --force"
cwd: "./pathToRepo/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- 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>
</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://hoten.cc"><img src="https://avatars1.githubusercontent.com/u/4071474?v=4" 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" width="100px;" alt=""/><br /><sub><b>Benedek Kozma</b></sub></a><br /><a href="#ideas-Cyberbeni" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/coffeegoddd"><img src="https://avatars3.githubusercontent.com/u/43383835?v=4" 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" 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" width="100px;" alt=""/><br /><sub><b>Kevin Saliou</b></sub></a><br /><a href="#ideas-kbsali" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</table>
<!-- markdownlint-enable -->
<!-- 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!
## License
This action is distributed under the MIT license, check the [license](LICENSE) for more info.
This action is distributed under the MIT license, check the [license](LICENSE) for more info.

View File

@@ -1,36 +1,48 @@
name: 'Add & Commit'
description: 'Add & commit files from a path directly from GitHub Actions'
name: Add & Commit
description: Add & commit files from a path directly from GitHub Actions
inputs:
author_name:
description: 'The name of the user that will be displayed as the author of the commit'
required: true
default: 'Add & Commit GitHub Action'
author_email:
description: 'The email of the user that will be displayed as the author of the commit'
required: true
default: 'actions@github.com'
force:
description: 'Whether to use the force option on git add, in order to bypass eventual gitignores'
add:
description: Arguments for the git add command
required: false
default: false
message:
description: 'The message for the commit'
required: true
default: 'Commit from GitHub Actions'
path:
description: 'The path to stage files from'
required: true
default: '.'
pattern:
description: 'The pattern that mathces file names'
author_name:
description: The name of the user that will be displayed as the author of the commit
required: false
author_email:
description: The email of the user that will be displayed as the author of the commit
required: false
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: '.'
message:
description: The message for the commit
required: false
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
required: false
remove:
description: Arguments for the git rm command
required: false
signoff:
description: Whether to use the --signoff option on git commit
required: false
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
default: "*.*"
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'git-commit'
color: black
runs:
using: node12
main: lib/index.js
branding:
icon: git-commit
color: gray-dark

View File

@@ -1,55 +0,0 @@
#!/bin/sh
set -eu
# 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 "actions@github.com"
git config --global user.name "Add & Commit GitHub Action"
}
add() {
if $INPUT_FORCE
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
fi
}
# This is needed to make the check work for untracked files
echo "Staging files in commit path..."
add
echo "Checking for uncommitted changes in the git working tree..."
# This section only runs if there have been file changes
if ! git diff --cached --exit-code
then
git_setup
git fetch
# Switch to branch from current Workflow run
echo "Creating and switching branch..."
git branch "${GITHUB_REF:11}"
git checkout "${GITHUB_REF:11}"
echo "Adding files..."
add
echo "Creating commit..."
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
echo "Pushing to repo..."
git push --set-upstream origin "${GITHUB_REF:11}"
else
echo "Working tree clean. Nothing to commit."
fi

1
lib/index.js Normal file

File diff suppressed because one or more lines are too long

1899
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

54
package.json Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "add-and-commit",
"version": "5.2.0",
"description": "Add & commit files from a path directly from GitHub Actions",
"main": "lib/index.js",
"scripts": {
"build": "npm run inputs && ncc build src/main.ts --minify --out lib",
"watch": "ncc build src/main.ts --watch --out lib",
"all-contributors-badge": "ts-node scripts/all-contributors-badge",
"changelog": "ts-node scripts/changelog.ts",
"inputs": "ts-node scripts/inputs.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"husky": {
"hooks": {
"pre-commit": "npm run build && git add src lib"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/EndBug/add-and-commit.git"
},
"keywords": [
"github",
"action",
"version",
"npm",
"node"
],
"author": "Federico Grandi <fgrandi30@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/EndBug/add-and-commit/issues"
},
"homepage": "https://github.com/EndBug/add-and-commit#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"axios": "^0.21.0",
"simple-git": "^2.21.0"
},
"devDependencies": {
"@types/node": "^12.12.54",
"@types/yamljs": "^0.2.31",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"@vercel/ncc": "^0.25.1",
"all-contributors-cli": "^6.19.0",
"eslint": "^6.8.0",
"husky": "^4.3.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.5",
"yamljs": "^0.3.0"
}
}

View File

@@ -0,0 +1,20 @@
import * as fs from 'fs'
import { resolve } from 'path'
function path(...segments: string[]) {
return resolve(__dirname, '..', ...segments)
}
const README = fs.readFileSync(path('README.md'), { encoding: 'utf8' }),
{ contributors } = JSON.parse(fs.readFileSync(path('.all-contributorsrc'), { encoding: 'utf8' }))
if (!(contributors instanceof Array)) throw new Error('Invalid config file')
const updatedREADME = README
.split('\n')
.map(line =>
line.startsWith('[![All Contributors](https://img.shields.io/badge/all_contributors-')
? `[![All Contributors](https://img.shields.io/badge/all_contributors-${contributors.length}-orange.svg?style=flat)](#contributors-)`
: line
).join('\n')
fs.writeFileSync(path('README.md'), updatedREADME)

44
scripts/changelog.ts Normal file
View File

@@ -0,0 +1,44 @@
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]')
? `[Unreleased]: https://github.com/EndBug/add-and-commit/compare/v${currentVersion}...HEAD`
: line)
// eslint-disable-next-line no-useless-escape
const lastVersion = ([...arr].reverse()[1]?.match(/\[([^\][]*)]/) || [])[0].replace(/[\[\]']+/g, '')
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)

11
scripts/inputs.ts Normal file
View File

@@ -0,0 +1,11 @@
import YAML from 'yamljs'
import fs from 'fs'
const actionManifest = YAML.load('action.yml'),
inputs = Object.keys(actionManifest?.inputs || {})
fs.writeFileSync('src/inputs.ts', `
// WARNING: this file is auto-generated by scripts/inputs.ts (npm run inputs), any manual edit will be overwritten.
export type Input = ${inputs.map(s => `'${s}'`).join(' | ')}
`.trimLeft())

3
src/inputs.ts Normal file
View File

@@ -0,0 +1,3 @@
// WARNING: this file is auto-generated by scripts/inputs.ts (npm run inputs), any manual edit will be overwritten.
export type Input = 'add' | 'author_name' | 'author_email' | 'branch' | 'cwd' | 'message' | 'pull_strategy' | 'push' | 'remove' | 'signoff' | 'tag'

245
src/main.ts Normal file
View File

@@ -0,0 +1,245 @@
import { info, setFailed, getInput as getInputCore, warning, debug, startGroup, endGroup, error } from '@actions/core'
import axios from 'axios'
import path from 'path'
import simpleGit, { Response } from 'simple-git'
import { Input } from './inputs'
const baseDir = path.join(process.cwd(), getInput('cwd') || '')
const git = simpleGit({ baseDir })
console.log(`Running in ${baseDir}`);
(async () => {
await checkInputs().catch(setFailed)
startGroup('Internal logs')
info('> Staging files...')
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
} : {})
}, log)
if (getInput('tag')) {
info('> Tagging commit...')
await git.tag(getInput('tag').split(' '), log)
} else info('> No tag info provided.')
if (getInput('push')) {
info('> Pushing commit to repo...')
await git.push('origin', getInput('branch'), { '--set-upstream': null }, log)
if (getInput('tag')) {
info('> Pushing tags to repo...')
await git.pushTags('origin', (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', log)
})
} else info('> No tags to push.')
} else info('> Not pushing anything.')
endGroup()
info('> Task completed.')
} else {
endGroup()
info('> Working tree clean. Nothing to commit.')
}
})().catch(e => {
endGroup()
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)
}
const eventPath = process.env.GITHUB_EVENT_PATH,
event = eventPath && require(eventPath),
token = process.env.GITHUB_TOKEN,
isPR = process.env.GITHUB_EVENT_NAME?.includes('pull_request'),
sha = (event?.pull_request?.head?.sha || process.env.GITHUB_SHA) as string,
defaultBranch = isPR
? event?.pull_request?.head?.ref as string
: process.env.GITHUB_REF?.substring(11)
// #region GITHUB_TOKEN
if (!token) warning('The GITHUB_TOKEN env variable is missing: the action may not work as expected.')
// #endregion
// #region add, remove
if (!getInput('add') && !getInput('remove'))
throw new Error('Both \'add\' and \'remove\' are empty, the action has nothing to do.')
// #endregion
// #region author_name, author_email
let author = event?.head_commit?.author
if (sha && !author) {
info('> Unable to get commit from workflow event: trying with the GitHub API...')
// https://docs.github.com/en/rest/reference/repos#get-a-commit--code-samples
const url = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/commits/${sha}`,
headers = token ? {
Authorization: `Bearer ${token}`
} : undefined,
commit = (await axios.get(url, { headers }).catch(err => {
startGroup('Request error:')
info(`> Request URL: ${url}\b${err}`)
endGroup()
return undefined
}))?.data
author = commit?.commit?.author
}
if (author) {
setDefault('author_name', author.name)
setDefault('author_email', author.email)
}
if (!getInput('author_name') || !getInput('author_email')) {
const reason = !eventPath
? 'event path'
: isPR
? sha
? 'fetch commit'
: 'find commit sha'
: !event?.head_commit
? 'find commit'
: 'find commit author'
warning(`Unable to fetch author info: couldn't ${reason}.`)
setDefault('author_name', 'Add & Commit Action')
setDefault('author_email', 'actions@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
setDefault('push', 'true')
if (getInput('push')) { // It's just to scope the parsed constant
const parsed = parseBool(getInput('push'))
if (parsed === undefined)
throw new Error(`"${getInput('push')}" is not a valid value for the 'push' input: only "true" and "false" are allowed.`)
if (!parsed)
setInput('push', undefined)
debug(`Current push option: ${getInput('push')} (${typeof getInput('push')})`)
}
// #endregion
}
function getInput(name: Input) {
return getInputCore(name)
}
function parseBool(value: any) {
try {
const parsed = JSON.parse(value)
if (typeof parsed == 'boolean')
return parsed
} catch { }
}
function log(err: any | Error, data?: any) {
if (data) console.log(data)
if (err) error(err)
}
function add({ logWarning = true, ignoreErrors = false } = {}): Promise<void | Response<void>> | void {
if (getInput('add'))
return git.add(getInput('add').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('Add command did not match any file.')
else throw e
})
}
function remove({ logWarning = true, ignoreErrors = false } = {}): Promise<void | Response<void>> | void {
if (getInput('remove'))
return git.rm(getInput('remove').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.')
else throw e
})
}

62
tsconfig.json Normal file
View File

@@ -0,0 +1,62 @@
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./build", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"exclude": [
"node_modules",
"**/*.test.ts",
"scripts"
]
}