From 42c7e256cd1691ef16ea9e413dc941aefb9bbb81 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 7 Jun 2021 11:25:35 -0400 Subject: [PATCH] Update README.md --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9a56a73..0d1127f 100644 --- a/README.md +++ b/README.md @@ -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' - run: | - echo "${{ steps.branch-name.outputs.current_branch }}" - # Outputs: "feature/test" current PR branch. - + - name: Current branch name if: github.event_name == 'push' run: | echo "${{ steps.branch-name.outputs.current_branch }}" # 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