mirror of
https://github.com/tj-actions/branch-names.git
synced 2024-11-23 19:13:51 +08:00
Update README.md
This commit is contained in:
parent
d2d681cfc4
commit
42c7e256cd
22
README.md
22
README.md
@ -25,23 +25,31 @@ Get branch or tag information without the `/ref/*` prefix
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
...
|
...
|
||||||
steps:
|
steps:
|
||||||
- name: Get branch names
|
- name: Get branch names
|
||||||
id: branch-name
|
id: branch-name
|
||||||
uses: tj-actions/branch-names@v4.3
|
uses: tj-actions/branch-names@v4.3
|
||||||
|
|
||||||
- name: Current branch name
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
|
||||||
echo "${{ steps.branch-name.outputs.current_branch }}"
|
|
||||||
# Outputs: "feature/test" current PR branch.
|
|
||||||
|
|
||||||
- name: Current branch name
|
- name: Current branch name
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
run: |
|
run: |
|
||||||
echo "${{ steps.branch-name.outputs.current_branch }}"
|
echo "${{ steps.branch-name.outputs.current_branch }}"
|
||||||
# Outputs: "main" the branch that triggered the push event.
|
# Outputs: "main" the branch that triggered the push event.
|
||||||
|
|
||||||
|
- name: Current branch name
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
run: |
|
||||||
|
echo "${{ steps.branch-name.outputs.current_branch }}"
|
||||||
|
# Outputs: "feature/test" the current PR branch.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
Loading…
Reference in New Issue
Block a user