docs(README): add outputs info
This commit is contained in:
62
README.md
62
README.md
@@ -1,4 +1,5 @@
|
|||||||
# Add & Commit
|
# 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>
|
<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>
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ Add a step like this to your workflow:
|
|||||||
|
|
||||||
# The arguments for the `git rm` command (see the paragraph below for more info)
|
# The arguments for the `git rm` command (see the paragraph below for more info)
|
||||||
# Default: ''
|
# Default: ''
|
||||||
remove: "./dir/old_file.js"
|
remove: './dir/old_file.js'
|
||||||
|
|
||||||
# Whether to use the --signoff option on `git commit` (only `true` and `false` are accepted)
|
# Whether to use the --signoff option on `git commit` (only `true` and `false` are accepted)
|
||||||
# Default: false
|
# Default: false
|
||||||
@@ -56,7 +57,7 @@ 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)
|
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
|
||||||
# Default: ''
|
# Default: ''
|
||||||
tag: "v1.0.0 --force"
|
tag: 'v1.0.0 --force'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# This is necessary in order to push a commit to the repo
|
# 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
|
|||||||
|
|
||||||
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).
|
||||||
|
|
||||||
|
### Outputs:
|
||||||
|
|
||||||
|
The action provides these outputs:
|
||||||
|
|
||||||
|
- `committed`: whether the action has created a commit (`'true'` or `'false'`)
|
||||||
|
- `pushed`: whether the action has pushed to teh remote(`'true'` or `'false'`)
|
||||||
|
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
|
||||||
|
|
||||||
|
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
|
||||||
|
|
||||||
### Examples:
|
### 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:
|
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:
|
||||||
@@ -95,29 +106,29 @@ jobs:
|
|||||||
name: Lint with ESLint
|
name: Lint with ESLint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Update source code
|
- name: Update source code
|
||||||
run: eslint "src/**" --fix
|
run: eslint "src/**" --fix
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: EndBug/add-and-commit@v5
|
uses: EndBug/add-and-commit@v5
|
||||||
with:
|
with:
|
||||||
author_name: Your Name
|
author_name: Your Name
|
||||||
author_email: mail@example.com
|
author_email: mail@example.com
|
||||||
message: "Your commit message"
|
message: 'Your commit message'
|
||||||
add: "*.js"
|
add: '*.js'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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.
|
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.
|
||||||
@@ -135,7 +146,7 @@ jobs:
|
|||||||
# If you need to, you can check out your repo to a different location
|
# If you need to, you can check out your repo to a different location
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
path: "./pathToRepo/"
|
path: './pathToRepo/'
|
||||||
|
|
||||||
# You can make whatever type of change to the repo...
|
# You can make whatever type of change to the repo...
|
||||||
- run: echo "123" > ./pathToRepo/file.txt
|
- run: echo "123" > ./pathToRepo/file.txt
|
||||||
@@ -143,9 +154,9 @@ jobs:
|
|||||||
# ...and then use the action as you would normally do, but providing the path to the repo
|
# ...and then use the action as you would normally do, but providing the path to the repo
|
||||||
- uses: EndBug/add-and-commit@v5
|
- uses: EndBug/add-and-commit@v5
|
||||||
with:
|
with:
|
||||||
message: "Add the very useful text file"
|
message: 'Add the very useful text file'
|
||||||
add: "*.txt --force"
|
add: '*.txt --force'
|
||||||
cwd: "./pathToRepo/"
|
cwd: './pathToRepo/'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -186,6 +197,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
|
|
||||||
<!-- markdownlint-enable -->
|
<!-- markdownlint-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user