debug: Retry using commit SHA

This commit is contained in:
Bart van der Braak 2023-06-11 01:00:22 +02:00
parent 4dd7664f29
commit 7772c6367e

View file

@ -34,9 +34,12 @@ jobs:
- name: Get Deployment Source Branch Name
id: git-branch
run: |
commit_sha=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/deployments/${{ github.event.deployment.id }}" \
| jq -r '.sha')
branch=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/deployments/${{ github.event.deployment.id }}" \
| jq -r '.ref' | cut -d "/" -f 3-)
"https://api.github.com/repos/${{ github.repository }}/commits/$commit_sha" \
| jq -r '.ref' | sed 's/refs\/heads\///')
echo "Source branch of deployment: $branch"
echo "SOURCE_REF=$branch" >> "$GITHUB_ENV"