Skip to content

Commit 18a23cd

Browse files
authored
feat: added extracted action
1 parent b086eaf commit 18a23cd

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: "Extract branch name"
3+
description: "Extract branch name based on pr or push"
4+
outputs:
5+
branch-name:
6+
description: "Branch name"
7+
value: ${{ steps.branch-name.outputs.branch-name }}
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: ⏬ Get branch name
12+
uses: actions/github-script@v6
13+
id: get-branch-name
14+
with:
15+
result-encoding: string
16+
script: |
17+
return (
18+
context?.payload?.pull_request?.head?.ref ||
19+
context?.payload?.ref || ""
20+
).replace("refs/heads/","");
21+
22+
- name: 🪑 Set output
23+
id: branch-name
24+
run: echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
25+
shell: bash
26+
env:
27+
BRANCH_NAME: ${{steps.get-branch-name.outputs.result}}

0 commit comments

Comments
 (0)