Update README.md

This commit is contained in:
Tonye Jack 2021-05-27 08:17:23 -04:00 committed by GitHub
parent 83d2546e09
commit 6f85513074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,11 +10,12 @@ Get branch or tag information without the `/ref/*` prefix
| Output | type | Example | Description |
|:--------------------:|:------------:|:---------------------------:|:-----------------------------------------------------------------:|
| is_default | `boolean` | `true` *OR* `false` | Detects wheter the action is running on a default branch |
| is_tag | `boolean` | `true` *OR* `false` | Detects wheter the action is running on a tag branch |
| current_branch | `string` | `main` *OR* `feature/test` | Always returns a valid branch name for a triggered workflow run. |
| base_ref_branch | `string` | `main` | The target branch of a pull request |
| head_ref_branch | `string` | `feature/test` | The source branch of a pull request |
| ref_branch | `string` | `1/merge` *OR* `main` | The branch that triggered the workflow run |
| tag | `string` | `v0.0.1` *OR* `0.0.1` | The tag that triggered the workflow run |
| tag | `string` | `v0.0.1` *OR* `0.0.1` | The tag that triggered the workflow run |
## Inputs
@ -28,7 +29,6 @@ Get branch or tag information without the `/ref/*` prefix
```yaml
...
steps:
- uses: actions/checkout@v2
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v4.2
@ -39,7 +39,6 @@ Get branch or tag information without the `/ref/*` prefix
```yaml
...
steps:
- uses: actions/checkout@v2
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v4.2
@ -56,6 +55,24 @@ Get branch or tag information without the `/ref/*` prefix
echo "Running on pr: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on pr: feature/test".
- name: Running on a tag branch.
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "Running on tag: ${{ steps.branch-name.outputs.tag }}"
# Outputs: "Running on tag: v0.0.1".
- name: Running on a non tag based branch and the default branch.
if: steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'true'
run: |
echo "Running on branch: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on branch: main".
- name: Running on a non tag based branch and a PR branch.
if: steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'false'
run: |
echo "Running on branch: ${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "Running on branch: feature/test".
- name: Current branch name
if: github.event_name == 'pull_request'
run: |
@ -114,6 +131,8 @@ on:
```
* Free software: [MIT license](LICENSE)