Skip to content

Commit

Permalink
feat: added extracted action
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke authored Sep 16, 2024
1 parent b086eaf commit 18a23cd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/actions/extract-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: "Extract branch name"
description: "Extract branch name based on pr or push"
outputs:
branch-name:
description: "Branch name"
value: ${{ steps.branch-name.outputs.branch-name }}
runs:
using: "composite"
steps:
- name: ⏬ Get branch name
uses: actions/github-script@v6
id: get-branch-name
with:
result-encoding: string
script: |
return (
context?.payload?.pull_request?.head?.ref ||
context?.payload?.ref || ""
).replace("refs/heads/","");
- name: 🪑 Set output
id: branch-name
run: echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
shell: bash
env:
BRANCH_NAME: ${{steps.get-branch-name.outputs.result}}

0 comments on commit 18a23cd

Please sign in to comment.