Compare commits

...

26 Commits

Author SHA1 Message Date
Federico Grandi
050a667872 release: v9.0.0 2022-03-11 22:59:13 +01:00
allcontributors[bot]
7fbfbfa278 docs: add Josh-Cena as a contributor for bug (#377)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-03-11 22:47:09 +01:00
Federico Grandi
0b47528fc7 fix!: fail when there's an error while committing (#376) 2022-03-11 22:44:53 +01:00
allcontributors[bot]
a3279e7b72 docs: add sconix as a contributor for ideas (#375)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-03-11 19:14:39 +01:00
Federico Grandi
0930a0f6f6 docs(README): add tag_push and tag_pushed 2022-03-11 19:09:48 +01:00
Federico Grandi
0e4f5f6417 feat: add tag_push input and tag_pushed output (#374) 2022-03-11 19:01:06 +01:00
dependabot[bot]
d67ae5f689 chore(deps-dev): bump ts-node from 10.5.0 to 10.7.0 (#373)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.5.0 to 10.7.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v10.5.0...v10.7.0)

---
updated-dependencies:
- dependency-name: ts-node
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 15:03:51 +01:00
dependabot[bot]
2cbf8ebce9 chore(deps-dev): bump typescript from 4.5.5 to 4.6.2 (#372)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.5.5...v4.6.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 15:01:09 +01:00
dependabot[bot]
6d7bd0506d chore(deps-dev): bump eslint-config-prettier from 8.4.0 to 8.5.0 (#371)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.4.0 to 8.5.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.4.0...v8.5.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 15:00:48 +01:00
Federico Grandi
e6dcd77d10 docs(README): remove "used by" badge
The built-in GitHub dependents stats are more accurate
2022-03-02 00:02:41 +01:00
dependabot[bot]
43eaf991fc chore(deps-dev): bump eslint-config-prettier from 8.3.0 to 8.4.0 (#368)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.3.0 to 8.4.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.3.0...v8.4.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-21 15:57:59 +01:00
dependabot[bot]
61b52dba1f chore(deps-dev): bump ts-node from 10.4.0 to 10.5.0 (#364)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.4.0 to 10.5.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v10.4.0...v10.5.0)

---
updated-dependencies:
- dependency-name: ts-node
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 19:39:05 +01:00
dependabot[bot]
f53a7db16d chore(deps-dev): bump @vercel/ncc from 0.33.1 to 0.33.3 (#363)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.33.1 to 0.33.3.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.33.1...0.33.3)

---
updated-dependencies:
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 19:38:37 +01:00
Federico Grandi
72e246094f release: v8.0.2 2022-02-07 14:42:37 +01:00
allcontributors[bot]
a9c53e5fc3 docs: add Namyalg as a contributor for doc (#361)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-02-07 14:40:02 +01:00
Federico Grandi
f9364915ea docs: list commit input in README
closes #360
2022-02-07 14:37:35 +01:00
dependabot[bot]
0d80c341c4 chore(deps-dev): bump typescript from 4.5.4 to 4.5.5 (#358)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.4 to 4.5.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.5.4...v4.5.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-24 20:24:43 +01:00
Federico Grandi
756d9ea820 release: v8.0.1 2022-01-23 23:49:26 +01:00
allcontributors[bot]
cb4f06fa66 docs: add prince-chrismc as a contributor for doc (#357)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-23 23:38:50 +01:00
Federico Grandi
3d8fcf9529 docs: add FAQ about PRs
closes #351
2022-01-23 23:35:47 +01:00
allcontributors[bot]
664b419dc5 docs: add secondmanveran as a contributor for doc (#356)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-23 23:23:14 +01:00
Federico Grandi
7b61ff5331 docs: fix outdated docs about the pull input
closes #354
2022-01-23 23:22:02 +01:00
Federico Grandi
017fbd6dce chore: lint source code 2022-01-23 23:13:35 +01:00
Federico Grandi
2103e93ecc chore: npm audit fix, update build 2022-01-23 23:09:07 +01:00
allcontributors[bot]
1a5e6d925d docs: add mcargille as a contributor for bug, code (#355)
* docs: update README.md [skip ci]

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

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-23 23:07:03 +01:00
mcargille
bfbc660a1b fix: add check to allow empty commits (#352)
* add check to allow empty commits if arg is set

* fix: target only the desired argument

* fix: add debug message

* fix: fix debug message

Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
2022-01-23 23:05:54 +01:00
9 changed files with 281 additions and 88 deletions

View File

@@ -314,6 +314,61 @@
"contributions": [
"bug"
]
},
{
"login": "mcargille",
"name": "mcargille",
"avatar_url": "https://avatars.githubusercontent.com/u/20142895?v=4",
"profile": "https://github.com/mcargille",
"contributions": [
"bug",
"code"
]
},
{
"login": "secondmanveran",
"name": "secondman",
"avatar_url": "https://avatars.githubusercontent.com/u/97000801?v=4",
"profile": "https://github.com/secondmanveran",
"contributions": [
"doc"
]
},
{
"login": "prince-chrismc",
"name": "Chris Mc",
"avatar_url": "https://avatars.githubusercontent.com/u/16867443?v=4",
"profile": "https://github.com/prince-chrismc",
"contributions": [
"doc"
]
},
{
"login": "Namyalg",
"name": "Namya LG",
"avatar_url": "https://avatars.githubusercontent.com/u/53875297?v=4",
"profile": "https://linkedin.com/in/namyalg",
"contributions": [
"doc"
]
},
{
"login": "sconix",
"name": "Janne Julkunen",
"avatar_url": "https://avatars.githubusercontent.com/u/921515?v=4",
"profile": "https://github.com/sconix",
"contributions": [
"ideas"
]
},
{
"login": "Josh-Cena",
"name": "Joshua Chen",
"avatar_url": "https://avatars.githubusercontent.com/u/55398995?v=4",
"profile": "https://joshcena.com",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7,

View File

@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [9.0.0] - 2022-03-11
### Changed:
- **[BREAKING]** The action will now fail when the `git commit` command fails. (#370)
- **[BREAKING]** The action won't try deleting and re-creting tags when it fails to push them, it's now up to you to set the proper arguments (see the `tag_push` input). (#367)
### Added:
- `tag_push` input: you can now set the arguments of the `git push --tags` command.
- `tag_pushed` output: whether the action pushed tags.
## [8.0.2] - 2022-02-07
### Fixed:
- The `commit` input is now properly listed in the README. (#360)
## [8.0.1] - 2022-01-23
### Fixed:
- Fixed a bug that prevented the `--allow-empty` flag from being used for the `commit` input. (#352)
- Fixed README and CHANGELOG docs for the `pull` input, that were still showing the option to use `NO-PULL` to prevent pulling (while now it's the default behavior). (#354)
- Added a paragraph to the FAQs section of the README, that explains how to work with PRs in v8. (#351)
## [8.0.0] - 2022-01-20
### Fixed:
@@ -18,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **[BREAKING]** The `signoff` input has been removed, use `commit` instead. (#331)
- **[BREAKING]** The `pull_strategy` input has been removed, use `pull` instead.
- **[BREAKING]** The `branch` and `branch_mode` inputs have been removed, check commit [`6fdb34e`](https://github.com/EndBug/add-and-commit/commit/6fdb34ed01d242c909eeb7e31bf1c4d37db43a54) for more info.
- **[BREAKING]** The `pull` input doesn't support `NO-PULL` anymore: if you don't want the action to pull, simply remove the input, as it's the default behavior now.
### Added:
@@ -290,7 +317,7 @@ First release
#
[unreleased]: https://github.com/EndBug/add-and-commit/compare/v8.0.0...HEAD
[unreleased]: https://github.com/EndBug/add-and-commit/compare/v9.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
@@ -329,3 +356,6 @@ First release
[7.4.0]: https://github.com/EndBug/add-and-commit/compare/v7.3.0...v7.4.0
[7.5.0]: https://github.com/EndBug/add-and-commit/compare/v7.4.0...v7.5.0
[8.0.0]: https://github.com/EndBug/add-and-commit/compare/v7.5.0...v8.0.0
[8.0.1]: https://github.com/EndBug/add-and-commit/compare/v8.0.0...v8.0.1
[8.0.2]: https://github.com/EndBug/add-and-commit/compare/v8.0.1...v8.0.2
[9.0.0]: https://github.com/EndBug/add-and-commit/compare/v8.0.2...v9.0.0

View File

@@ -1,6 +1,5 @@
# Add & Commit
[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-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...
@@ -18,7 +17,7 @@ You can use this GitHub Action to commit changes made in your workflow run direc
Add a step like this to your workflow:
```yaml
- uses: EndBug/add-and-commit@v8 # You can change this to use a specific version.
- uses: EndBug/add-and-commit@v9 # 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: '.'
@@ -32,6 +31,10 @@ Add a step like this to your workflow:
# Default: depends on the default_author input
author_email: mail@example.com
# Additional arguments for the git commit command. The --message argument is already set by the message input.
# Default: ''
commit: --signoff
# The name of the custom committer you want to use, if different from the author of the commit.
# Default: the name of the author (set with either author_name or default_author)
committer_name: Committer Name
@@ -66,9 +69,9 @@ Add a step like this to your workflow:
# Default: ignore
pathspec_error_handling: ignore
# Arguments for the git pull command. Use NO-PULL to avoid the action pulling at all.
# Default: '--no-rebase'
pull: 'NO-PULL or --rebase --autostash ...'
# Arguments for the git pull command. By default, the action does not pull.
# Default: ''
pull: '--rebase --autostash ...'
# 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
@@ -81,6 +84,10 @@ Add a step like this to your workflow:
# 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'
# Arguments for the git push --tags command (any additional argument will be added after --tags)
# Default: ''
tag_push: '--force
```
### Git arguments
@@ -127,7 +134,9 @@ If you want to commit files "across different branches", here are two ways to do
### 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).
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).
You can also change the arguments of the push command for tags: every argument in the `tag_push` input will be appended to the `git push --tags` command.
For more info on how git arguments are parsed, see [the "Git arguments" section](#git-arguments).
## Outputs
@@ -138,11 +147,34 @@ The action provides these outputs:
- `commit_sha`: the short 7-character SHA of the commit that has just been created
- `pushed`: whether the action has pushed to the remote (`'true'` or `'false'`)
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
- `tag_pushed`: whether the action has pushed 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).
## FAQs
### Working with PRs
By default, when you use `actions/checkout` on a PR, it will checkout the head commit in a detached head state.
If you want to make some changes, you have to checkout the branch the PR is coming from in the head repo.
You can set it up like this:
```yaml
- uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
```
You can find the full docs for payloads of `pull_request` events [here](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-example-32).
If you're planning on running this only on "internal" PRs (where head and base are in the same repo) then you can omit the `repository` input.
If you're planning to use this with PRs coming from other forks, please keep in mind that you might not have write access to those repos.
You can try setting up the repo with your PAT, as explained in the ["About tokens" paragraph](#about-tokens) of this section.
Keep in mind that this "custom checkout" is meant only for PRs: if your workflow runs on multiple events (like `push` or `workflow_dispatch`), you could try having this step run only for `pull_request` events, while other ones will trigger the usual checkout.
If you wish to do so, you can use the `step.if` property, [here](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsif)'s the docs.
### About 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.
@@ -182,7 +214,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: EndBug/add-and-commit@v8
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
```
@@ -192,7 +224,7 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
<img src="https://user-images.githubusercontent.com/26386270/130594168-1d910710-e2d0-4b06-9324-cbe5dde59154.png" height=70/>
```yaml
- uses: EndBug/add-and-commit@v8
- uses: EndBug/add-and-commit@v9
with:
message: Show GitHub Actions logo
committer_name: GitHub Actions
@@ -202,7 +234,7 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
<img src="https://user-images.githubusercontent.com/26386270/130594443-b881fae7-3064-4020-a4cc-6db37ef0df65.png" height=70/>
```yaml
- uses: EndBug/add-and-commit@v8
- uses: EndBug/add-and-commit@v9
with:
message: Show GitHub logo
committer_name: GitHub Actions
@@ -237,7 +269,7 @@ jobs:
run: eslint "src/**" --fix
- name: Commit changes
uses: EndBug/add-and-commit@v8
uses: EndBug/add-and-commit@v9
with:
author_name: Your Name
author_email: mail@example.com
@@ -268,7 +300,7 @@ jobs:
- 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@v8
- uses: EndBug/add-and-commit@v9
with:
message: 'Add the very useful text file'
add: '*.txt --force'
@@ -325,6 +357,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="http://blog.madewithdrew.com/"><img src="https://avatars.githubusercontent.com/u/239123?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Drew Wells</b></sub></a><br /><a href="#ideas-drewwells" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://kotlin.desarrollador-android.com/"><img src="https://avatars.githubusercontent.com/u/7463564?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Javier Segovia Córdoba</b></sub></a><br /><a href="#ideas-JavierSegoviaCordoba" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/Darylgolden"><img src="https://avatars.githubusercontent.com/u/9102529?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Darylgolden</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3ADarylgolden" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/mcargille"><img src="https://avatars.githubusercontent.com/u/20142895?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mcargille</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3Amcargille" title="Bug reports">🐛</a> <a href="https://github.com/EndBug/add-and-commit/commits?author=mcargille" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/secondmanveran"><img src="https://avatars.githubusercontent.com/u/97000801?v=4?s=100" width="100px;" alt=""/><br /><sub><b>secondman</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=secondmanveran" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/prince-chrismc"><img src="https://avatars.githubusercontent.com/u/16867443?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Mc</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=prince-chrismc" title="Documentation">📖</a></td>
<td align="center"><a href="https://linkedin.com/in/namyalg"><img src="https://avatars.githubusercontent.com/u/53875297?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Namya LG</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/commits?author=Namyalg" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/sconix"><img src="https://avatars.githubusercontent.com/u/921515?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Janne Julkunen</b></sub></a><br /><a href="#ideas-sconix" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://joshcena.com"><img src="https://avatars.githubusercontent.com/u/55398995?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joshua Chen</b></sub></a><br /><a href="https://github.com/EndBug/add-and-commit/issues?q=author%3AJosh-Cena" title="Bug reports">🐛</a></td>
</tr>
</table>

View File

@@ -52,6 +52,9 @@ inputs:
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
tag_push:
description: Arguments for the git push --tags command (any additional argument will be added after --tags)
required: false
# Input not required from the user
github_token:
@@ -70,6 +73,8 @@ outputs:
description: Whether the action has pushed to the remote.
tagged:
description: Whether the action has created a tag.
tag_pushed:
description: Whether the action has pushed a tag.
runs:
using: node12

4
lib/index.js generated

File diff suppressed because one or more lines are too long

139
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "add-and-commit",
"version": "8.0.0",
"version": "9.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "add-and-commit",
"version": "8.0.0",
"version": "9.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.6.0",
@@ -20,15 +20,15 @@
"@types/node": "^12.12.54",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@vercel/ncc": "^0.33.1",
"@vercel/ncc": "^0.33.3",
"all-contributors-cli": "^6.20.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.2",
"yamljs": "^0.3.0"
}
},
@@ -729,9 +729,9 @@
}
},
"node_modules/@vercel/ncc": {
"version": "0.33.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==",
"version": "0.33.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz",
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
@@ -1251,9 +1251,9 @@
}
},
"node_modules/eslint-config-prettier": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz",
"integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==",
"dev": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
@@ -2268,11 +2268,22 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
},
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/npm-run-path": {
@@ -3099,10 +3110,15 @@
"node": ">=8.0"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"node_modules/ts-node": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
"version": "10.7.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz",
"integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==",
"dev": true,
"dependencies": {
"@cspotcode/source-map-support": "0.7.0",
@@ -3116,11 +3132,13 @@
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"v8-compile-cache-lib": "^3.0.0",
"yn": "3.1.1"
},
"bin": {
"ts-node": "dist/bin.js",
"ts-node-cwd": "dist/bin-cwd.js",
"ts-node-esm": "dist/bin-esm.js",
"ts-node-script": "dist/bin-script.js",
"ts-node-transpile-only": "dist/bin-transpile.js",
"ts-script": "dist/bin-script-deprecated.js"
@@ -3206,9 +3224,9 @@
}
},
"node_modules/typescript": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -3241,6 +3259,26 @@
"integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==",
"dev": true
},
"node_modules/v8-compile-cache-lib": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz",
"integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==",
"dev": true
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -3964,9 +4002,9 @@
}
},
"@vercel/ncc": {
"version": "0.33.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==",
"version": "0.33.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz",
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==",
"dev": true
},
"acorn": {
@@ -4398,9 +4436,9 @@
}
},
"eslint-config-prettier": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz",
"integrity": "sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==",
"dev": true,
"requires": {}
},
@@ -5149,9 +5187,12 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
}
},
"npm-run-path": {
"version": "2.0.2",
@@ -5748,10 +5789,15 @@
"is-number": "^7.0.0"
}
},
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
"ts-node": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
"version": "10.7.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz",
"integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==",
"dev": true,
"requires": {
"@cspotcode/source-map-support": "0.7.0",
@@ -5765,6 +5811,7 @@
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"v8-compile-cache-lib": "^3.0.0",
"yn": "3.1.1"
},
"dependencies": {
@@ -5812,9 +5859,9 @@
"dev": true
},
"typescript": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
"dev": true
},
"universal-user-agent": {
@@ -5840,6 +5887,26 @@
"integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==",
"dev": true
},
"v8-compile-cache-lib": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz",
"integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==",
"dev": true
},
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "add-and-commit",
"version": "8.0.0",
"version": "9.0.0",
"private": true,
"description": "Add & commit files from a path directly from GitHub Actions",
"main": "lib/index.js",
@@ -42,15 +42,15 @@
"@types/node": "^12.12.54",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@vercel/ncc": "^0.33.1",
"@vercel/ncc": "^0.33.3",
"all-contributors-cli": "^6.20.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.2",
"yamljs": "^0.3.0"
}
}

View File

@@ -17,6 +17,7 @@ interface InputTypes {
push: string
remove: string | undefined
tag: string | undefined
tag_push: string | undefined
github_token: string | undefined
}
@@ -28,6 +29,7 @@ interface OutputTypes {
commit_sha: string | undefined
pushed: 'true' | 'false'
tagged: 'true' | 'false'
tag_pushed: 'true' | 'false'
}
export type output = keyof OutputTypes
@@ -36,7 +38,8 @@ export const outputs: OutputTypes = {
commit_long_sha: undefined,
commit_sha: undefined,
pushed: 'false',
tagged: 'false'
tagged: 'false',
tag_pushed: 'false'
}
// Setup default output values
Object.entries(outputs).forEach(([name, value]) => core.setOutput(name, value))

View File

@@ -30,8 +30,17 @@ core.info(`Running in ${baseDir}`)
core.info('> Checking for uncommitted changes in the git working tree...')
const changedFiles = (await git.diffSummary(['--cached'])).files.length
if (changedFiles > 0) {
// continue if there are any changes or if the allow-empty commit argument is included
if (
changedFiles > 0 ||
matchGitArgs(getInput('commit') || '').includes('--allow-empty')
) {
core.info(`> Found ${changedFiles} changed files.`)
core.debug(
`--allow-empty argument detected: ${matchGitArgs(
getInput('commit') || ''
).includes('--allow-empty')}`
)
await git
.addConfig('user.email', getInput('author_email'), undefined, log)
@@ -70,20 +79,18 @@ core.info(`Running in ${baseDir}`)
} else core.info('> Not pulling from repo.')
core.info('> Creating commit...')
const commitData = await git
await git
.commit(getInput('message'), matchGitArgs(getInput('commit') || ''))
.catch((err) => {
log(err)
.then(async (data) => {
log(undefined, data)
setOutput('committed', 'true')
setOutput('commit_sha', data.commit)
await git
.revparse(data.commit)
.then((long_sha) => setOutput('commit_long_sha', long_sha))
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
})
if (commitData) {
log(undefined, commitData)
setOutput('committed', 'true')
setOutput('commit_sha', commitData.commit)
await git
.revparse(commitData.commit)
.then((long_sha) => setOutput('commit_long_sha', long_sha))
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
}
.catch((err) => core.setFailed(err))
if (getInput('tag')) {
core.info('> Tagging commit...')
@@ -140,26 +147,12 @@ core.info(`Running in ${baseDir}`)
if (getInput('tag')) {
core.info('> Pushing tags to repo...')
await git
.pushTags('origin', undefined, (e, d?) => log(undefined, e || d))
.catch(() => {
core.info(
'> Tag push failed: deleting remote tag and re-pushing...'
)
return git
.push(
undefined,
undefined,
{
'--delete': null,
origin: null,
[matchGitArgs(getInput('tag') || '').filter(
(w) => !w.startsWith('-')
)[0]]: null
},
log
)
.pushTags('origin', undefined, log)
.pushTags('origin', matchGitArgs(getInput('tag_push') || ''))
.then((data) => {
setOutput('tag_pushed', 'true')
return log(null, data)
})
.catch((err) => core.setFailed(err))
} else core.info('> No tags to push.')
} else core.info('> Not pushing anything.')