Get the branch or tag ref on delete

Is it possible to get the branch name or tag ref on delete?


    runs-on: ubuntu-latest
      - uses: actions/checkout@v1
      - run: echo ${GITHUB_REF}

As per the docs, $GITHUB_REF resolves to the “default branch”, which in my case is master. I’m struggling to see how returning the default branch is more useful than resolving the actual branch or tag ref that was deleted.

Is there any way to get the deleted branch name?

The event payload for delete has this infoarmtion

You can use the github context to access data in that payload


Just to add to this for people like me who didn’t know how to access the ref and ref_type properties for the event this is how you do it in the yaml:

- name: Hello
  run: echo "${{ github.event.ref }} - ${{ github.event.ref_type }}"
1 Like