We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b086eaf commit 18a23cdCopy full SHA for 18a23cd
.github/actions/extract-branch/action.yml
@@ -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