Skip to content

Commit 3bee5ae

Browse files
committed
docs(README): add outputs info
1 parent 5cb8787 commit 3bee5ae

File tree

2 files changed

+45
-33
lines changed

2 files changed

+45
-33
lines changed

README.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Add & Commit
2+
23
<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>
34
[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat)](#contributors-)
45

@@ -48,15 +49,15 @@ Add a step like this to your workflow:
4849

4950
# The arguments for the `git rm` command (see the paragraph below for more info)
5051
# Default: ''
51-
remove: "./dir/old_file.js"
52+
remove: './dir/old_file.js'
5253

5354
# Whether to use the --signoff option on `git commit` (only `true` and `false` are accepted)
5455
# Default: false
5556
signoff: true
5657

5758
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
5859
# Default: ''
59-
tag: "v1.0.0 --force"
60+
tag: 'v1.0.0 --force'
6061

6162
env:
6263
# This is necessary in order to push a commit to the repo
@@ -82,6 +83,16 @@ The script will not stop if one of the git commands fails. E.g.: if your command
8283

8384
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).
8485

86+
### Outputs:
87+
88+
The action provides these outputs:
89+
90+
- `committed`: whether the action has created a commit (`'true'` or `'false'`)
91+
- `pushed`: whether the action has pushed to teh remote(`'true'` or `'false'`)
92+
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
93+
94+
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).
95+
8596
### Examples:
8697

8798
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:
@@ -90,34 +101,34 @@ Do you want to lint your JavaScript files, located in the `src` folder, with ESL
90101
name: Lint source code
91102
on: push
92103
93-
jobs:
104+
jobs:
94105
run:
95106
name: Lint with ESLint
96107
runs-on: ubuntu-latest
97-
steps:
98-
- name: Checkout repo
99-
uses: actions/checkout@v2
100-
101-
- name: Set up Node.js
102-
uses: actions/setup-node@v1
103-
with:
104-
node-version: 12.x
105-
106-
- name: Install dependencies
107-
run: npm install
108-
109-
- name: Update source code
110-
run: eslint "src/**" --fix
111-
112-
- name: Commit changes
113-
uses: EndBug/add-and-commit@v5
114-
with:
115-
author_name: Your Name
116-
author_email: [email protected]
117-
message: "Your commit message"
118-
add: "*.js"
119-
env:
120-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
steps:
109+
- name: Checkout repo
110+
uses: actions/checkout@v2
111+
112+
- name: Set up Node.js
113+
uses: actions/setup-node@v1
114+
with:
115+
node-version: 12.x
116+
117+
- name: Install dependencies
118+
run: npm install
119+
120+
- name: Update source code
121+
run: eslint "src/**" --fix
122+
123+
- name: Commit changes
124+
uses: EndBug/add-and-commit@v5
125+
with:
126+
author_name: Your Name
127+
author_email: [email protected]
128+
message: 'Your commit message'
129+
add: '*.js'
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121132
```
122133

123134
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.
@@ -126,7 +137,7 @@ If you need to run the action on a repository that is not located in [`$GITHUB_W
126137
name: Use a different repository directory
127138
on: push
128139
129-
jobs:
140+
jobs:
130141
run:
131142
name: Add a text file
132143
runs-on: ubuntu-latest
@@ -135,17 +146,17 @@ jobs:
135146
# If you need to, you can check out your repo to a different location
136147
- uses: actions/checkout@v2
137148
with:
138-
path: "./pathToRepo/"
149+
path: './pathToRepo/'
139150
140151
# You can make whatever type of change to the repo...
141152
- run: echo "123" > ./pathToRepo/file.txt
142153
143154
# ...and then use the action as you would normally do, but providing the path to the repo
144155
- uses: EndBug/add-and-commit@v5
145156
with:
146-
message: "Add the very useful text file"
147-
add: "*.txt --force"
148-
cwd: "./pathToRepo/"
157+
message: 'Add the very useful text file'
158+
add: '*.txt --force'
159+
cwd: './pathToRepo/'
149160
env:
150161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151162
```
@@ -186,6 +197,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
186197

187198
<!-- markdownlint-enable -->
188199
<!-- prettier-ignore-end -->
200+
189201
<!-- ALL-CONTRIBUTORS-LIST:END -->
190202

191203
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

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)