Skip to content

Commit 8693022

Browse files
authored
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
1 parent c7b6856 commit 8693022

File tree

13 files changed

+344
-715
lines changed

13 files changed

+344
-715
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"new-cap": 0,
3737
"no-caller": 2,
3838
"no-undef": 2,
39-
"no-unused-vars": 1,
39+
"no-unused-vars": 0,
40+
"@typescript-eslint/no-unused-vars": "warn",
4041
"no-empty": [
4142
"error",
4243
{

.github/workflows/build.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,27 @@ jobs:
1111
name: Build compiled JS version
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v2
14+
- uses: actions/checkout@v2
1615

17-
- name: Set up Node.js
18-
uses: actions/setup-node@v1
16+
- uses: actions/setup-node@v1
1917
with:
2018
node-version: 12.x
2119

22-
- name: Install dependencies
23-
run: npm install
20+
- run: npm install
2421

25-
- name: Compile TypeScript into compressed JavaScript
26-
run: npm run build
22+
- run: npm run build
2723

28-
- name: Commit changes
29-
uses: EndBug/add-and-commit@v4
24+
- uses: EndBug/add-and-commit@v4
3025
with:
31-
message: "[auto] build: update compiled version"
26+
message: '[auto] build: update compiled version'
3227
add: lib
3328
force: true
3429
env:
3530
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- uses: EndBug/add-and-commit@v4
33+
with:
34+
message: '[auto] build: update input typings'
35+
add: src/inputs.ts
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This action lets you choose the path that you want to use when adding & committi
1212
Add a step like this to your workflow:
1313

1414
```yaml
15-
- uses: EndBug/add-and-commit@v4 # You can change this to use a specific version
15+
- uses: EndBug/add-and-commit@v5 # You can change this to use a specific version
1616
with:
1717
# The arguments for the `git add` command (see the paragraph below for more info)
1818
# Default: '.'
@@ -26,33 +26,29 @@ Add a step like this to your workflow:
2626
# Default: author of the commit that triggered the run
2727
author_email: mail@example.com
2828

29+
# Name of the branch to use, if different from the one that triggered the workflow
30+
# Default: the branch that triggered the run
31+
branch: some-branch
32+
2933
# The local path to the directory where your repository is located. You should use actions/checkout first to set it up
3034
# Default: '.'
3135
cwd: './path/to/the/repo'
3236

33-
# Whether to use the --force option on `git add`, in order to bypass eventual gitignores
34-
# Default: false
35-
force: true
36-
37-
# Whether to use the --signoff option on `git commit`
38-
# Default: false
39-
signoff: true
40-
4137
# The message for the commit
4238
# Default: 'Commit from GitHub Actions'
4339
message: 'Your commit message'
4440

45-
# Name of the branch to use, if different from the one that triggered the workflow
46-
# Default: the branch that triggered the workflow (from GITHUB_REF)
47-
ref: 'someOtherBranch'
48-
4941
# The arguments for the `git rm` command (see the paragraph below for more info)
5042
# Default: ''
5143
remove: "./dir/old_file.js"
5244

53-
# Name of the tag to add to the new commit (see the paragraph below for more info)
45+
# Whether to use the --signoff option on `git commit` (only `true` and `false` are accepted)
46+
# Default: false
47+
signoff: true
48+
49+
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
5450
# Default: ''
55-
tag: "v1.0.0"
51+
tag: "v1.0.0 --force"
5652

5753
env:
5854
# This is necessary in order to push a commit to the repo
@@ -66,18 +62,17 @@ That said, you can just copy the example line and not worry about it. If you do
6662

6763
### Adding files:
6864

69-
The action adds files using a regular `git add` command, so you can put every kind of argument in the `add` option. For example, if you don't want it to use a recursive behavior: `$(find . -maxdepth 1 -name *.js)`.
65+
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`.
7066
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.
7167

7268
### Deleting files:
7369

74-
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.
70+
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).
7571
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.
7672

7773
### Tagging:
7874

79-
You can tag commits with the `tag` option: when used, it will create a lightweight tag for the commit with the name you set as input. If not entered (or if an empty string is passed) teh action won't create any tag.
80-
If there is already a tag with the name you entered it will be overwritten, and so the tag will be "updated".
75+
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).
8176

8277
### Examples:
8378

@@ -107,7 +102,7 @@ jobs:
107102
run: eslint "src/**" --fix
108103
109104
- name: Commit changes
110-
uses: EndBug/add-and-commit@v4
105+
uses: EndBug/add-and-commit@v5
111106
with:
112107
author_name: Your Name
113108
author_email: mail@example.com
@@ -138,12 +133,11 @@ jobs:
138133
- run: echo "123" > ./pathToRepo/file.txt
139134
140135
# ...and then use the action as you would normally do, but providing the path to the repo
141-
- uses: EndBug/add-and-commit@v4
136+
- uses: EndBug/add-and-commit@v5
142137
with:
143138
message: "Add the very useful text file"
144-
add: "*.txt"
139+
add: "*.txt --force"
145140
cwd: "./pathToRepo/"
146-
force: true
147141
env:
148142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149143
```

action.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,33 @@ inputs:
55
add:
66
description: Arguments for the git add command
77
required: false
8-
default: "."
8+
default: '.'
99
author_name:
1010
description: The name of the user that will be displayed as the author of the commit
1111
required: false
1212
author_email:
1313
description: The email of the user that will be displayed as the author of the commit
1414
required: false
15+
branch:
16+
description: Name of the branch to use, if different from the one that triggered the workflow
17+
required: false
1518
cwd:
1619
description: The directory where your repository is located. You should use actions/checkout first to set it up
1720
required: false
18-
default: "."
19-
force:
20-
description: Whether to use the force option on git add, in order to bypass eventual gitignores
21-
required: false
22-
default: "false"
23-
signoff:
24-
description: Whether to use the signoff option on git commit
25-
required: false
26-
default: "false"
21+
default: '.'
2722
message:
2823
description: The message for the commit
2924
required: false
3025
default: Commit from GitHub Actions
31-
ref:
32-
description: Name of the branch to use, if different from the one that triggered the workflow
33-
required: false
3426
remove:
3527
description: Arguments for the git rm command
3628
required: false
37-
default: ""
29+
signoff:
30+
description: Whether to use the --signoff option on git commit
31+
required: false
3832
tag:
39-
description: The name of the tag to add to the new commit
33+
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
4034
required: false
41-
default: ""
4235

4336
runs:
4437
using: node12

lib/.gitkeep

Whitespace-only changes.

lib/entrypoint.sh

Lines changed: 0 additions & 88 deletions
This file was deleted.

lib/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)