Skip to content

Commit

Permalink
add validation for None value
Browse files Browse the repository at this point in the history
  • Loading branch information
McKnight-42 committed Jul 19, 2024
1 parent 0c88154 commit ff10395
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/release-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ jobs:
id: get_last_successful_release_run
run: |
last_run_url=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=workflow_dispatch&status=success&branch=main&workflow_file=release-internal.yml" | jq -r '.workflow_runs[0].url')
if [ -z "$last_run_url" ]; then
echo "No successful Release to Cloud run found."
exit 1
fi
echo "Last run URL: $last_run_url"
commit_sha=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $last_run_url | jq -r '.head_sha')
commit_sha=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$last_run_url" | jq -r '.head_sha')
if [ -z "$commit_sha" ]; then
echo "No commit SHA found for the last successful run."
exit 1
fi
echo "Commit SHA: $commit_sha"
echo "commit_sha=$commit_sha" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit ff10395

Please sign in to comment.