diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 53cdf7c..baf5c56 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -186,16 +186,9 @@ jobs: results: ${{ runner.os }}-r${{ matrix.r }} - uses: ./.github/workflows/update-status - if: success() + if: always() with: sha: ${{ needs.rcc-smoke.outputs.sha }} - state: success - - - uses: ./.github/workflows/update-status - if: failure() - with: - sha: ${{ needs.rcc-smoke.outputs.sha }} - state: failure suggests-matrix: runs-on: ubuntu-22.04 diff --git a/.github/workflows/update-status/action.yml b/.github/workflows/update-status/action.yml index f3d2e32..a38eb1c 100644 --- a/.github/workflows/update-status/action.yml +++ b/.github/workflows/update-status/action.yml @@ -11,6 +11,9 @@ inputs: runs: using: "composite" steps: + # It's difficult to get the URL of the current job. + # The /jobs API and/or the `github` context are misaligned. + # The duckdbneo repository contains several failed attempts. - run: | set -x if [ -n ${{ inputs.sha }} ]; then @@ -20,7 +23,12 @@ runs: -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" + -f "state=${{ job.status }}" -f "description=${{ github.job_id }}" -f "context=actions-sync" + + gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.repository }}/actions/runs/${{ github.run_id }} html_url=$(gh api \ -H "Accept: application/vnd.github+json" \ @@ -29,10 +37,6 @@ runs: 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 shell: bash