github.com/cosmos/cosmos-sdk@v0.50.10/.github/actions/last-workflow-status/action.yaml (about)

     1  # from https://github.com/MercymeIlya/last-workflow-status with fixes
     2  name: "Get status of last workflow"
     3  description: "Get conclusion of last workflow run on current branch."
     4  branding:
     5    icon: "arrow-left"
     6    color: "yellow"
     7  inputs:
     8    github_token:
     9      description: Secret GitHub API token to use for making API requests.
    10      default: ${{ github.token }}
    11      required: true
    12  outputs:
    13    last_status:
    14      description: "Conclusion of last workflow run on current branch"
    15      value: ${{ steps.last_status.outputs.last_status }}
    16  runs:
    17    using: "composite"
    18    steps:
    19      - name: Get workflow id
    20        shell: bash
    21        run: |
    22          WORKFLOW_ID=$(curl --header 'authorization: Bearer ${{ inputs.github_token }}' \
    23                             --header 'content-type: application/json' \
    24          https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r .workflow_id)
    25          echo "WORKFLOW_ID=$WORKFLOW_ID" >> $GITHUB_ENV
    26          echo "Workflow id: ${WORKFLOW_ID}"
    27      - name: Get previous build status
    28        shell: bash
    29        id: last_status
    30        run: |
    31          last_status=$(curl --silent --header 'authorization: Bearer ${{ inputs.github_token }}' \
    32                                      --header 'content-type: application/json' \
    33          "https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ env.GITHUB_HEAD_REF }}" \
    34          | jq -r .workflow_runs[0].conclusion)
    35          echo "Status of the previous build: $last_status"
    36          echo "::set-output name=last_status::${last_status}"