Skip to content

Commit

Permalink
ci: Get HTML URL
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jun 26, 2024
1 parent 2de0312 commit aa2edb8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/update-status/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@ runs:
- run: |
set -x
if [ -n ${{ inputs.sha }} ]; then
GH_TOKEN=${{ github.token }} gh api \
export GH_TOKEN=${{ github.token }}
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/statuses/${{ inputs.sha }} \
-f "state=${{ inputs.state }}" -f "context=actions-sync"
html_url=$(curl -f -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq . | tee /dev/stderr | jq '.jobs[] | select (.name == ${{ env.GITHUB_JOB }}) | .html_url')
html_url=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq . | tee /dev/stderr | jq '.jobs[] | select (.name == ${{ github.job }}) | .html_url')
echo $html_url
html_url=$(curl -f -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq . | tee /dev/stderr | jq '.jobs[] | select (.name == ${{ github.job }}) | .html_url')
echo $html_url
# curl -f -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ github.token }}" https://api.github.com/repos/${{ github.repository }}/statuses/${{ inputs.sha }} -d '{"state": "${{ inputs.state }}", "context": "${{ github.workflow }} / ${{ github.job }}", "target_url": '${html_url}' }'
fi
Expand Down

0 comments on commit aa2edb8

Please sign in to comment.