Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Jun 7, 2021
1 parent d2d681c commit 42c7e25
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions README.md
Expand Up @@ -25,23 +25,31 @@ Get branch or tag information without the `/ref/*` prefix
## Usage

```yaml
on:
push:
branches:
- main
pull_request:
branches:
- main

...
steps:
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v4.3

- name: Current branch name
if: github.event_name == 'pull_request'
if: github.event_name == 'push'
run: |
echo "${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "feature/test" current PR branch.
# Outputs: "main" the branch that triggered the push event.

- name: Current branch name
if: github.event_name == 'push'
if: github.event_name == 'pull_request'
run: |
echo "${{ steps.branch-name.outputs.current_branch }}"
# Outputs: "main" the branch that triggered the push event.
# Outputs: "feature/test" the current PR branch.
```

## Examples
Expand Down

0 comments on commit 42c7e25

Please sign in to comment.