mirror of
https://github.com/tj-actions/branch-names.git
synced 2024-11-27 10:43:52 +08:00
Update README.md
This commit is contained in:
parent
83d2546e09
commit
6f85513074
23
README.md
23
README.md
@ -10,6 +10,7 @@ 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 |
|
||||
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user