I am trying to extract the branch name on a delete event. Turns out it's not in the GITHUB_REF object as that will be the default branch
.
Ordinarily I would run
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
But apparently with delete events I need to extract the branch via ${{ github.event.ref }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${{ github.event.ref }})" # how to drop refs/heads/?
id: extract_branch
now I don't know how to drop the refs/heads aspect of the branch name.
EDIT: Since in the delete event case, github.event.ref
already contains the simple branch name e.g. feature-1-my-branch
and not refs/heads/feature-1-my-branch
my example code above works.
In the event I want to do some post-processing on this context in a different event type, where github.event.ref
returns refs/heads/feature-1-my-branch
how would I drop the refs/heads
in that case?