From 454d818866af405c45b9a05335e34feb4ef22e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=B4=87=CA=80=C9=B4=E1=B4=85=20S=E1=B4=84=CA=9C?= =?UTF-8?q?=E1=B4=8F=CA=80=C9=A2=E1=B4=87=CA=80s?= Date: Sat, 24 Jul 2021 13:31:19 +0200 Subject: [PATCH] ci: Use check_run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs --- .../metadata-label-pr-ci-status.yaml | 202 +++++++++++++----- 1 file changed, 151 insertions(+), 51 deletions(-) diff --git a/.github/workflows/metadata-label-pr-ci-status.yaml b/.github/workflows/metadata-label-pr-ci-status.yaml index 26aa3aca..03b0ea35 100644 --- a/.github/workflows/metadata-label-pr-ci-status.yaml +++ b/.github/workflows/metadata-label-pr-ci-status.yaml @@ -2,67 +2,167 @@ name: "Metadata: Label pull requests CI status" on: - workflow_run: - workflows: - - "Pre-commit consistency check" + check_run: types: - completed + # workflow_run: + # workflows: + # - "Pre-commit consistency check" + # types: + # - completed jobs: get-info: name: "Get information about the source run" runs-on: ubuntu-20.04 - outputs: - pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} + # outputs: + # pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} steps: - - name: "Get information about the origin 'CI' run" - uses: potiuk/get-workflow-origin@v1_3 - id: source-run-info - with: - token: ${{ secrets.GITHUB_TOKEN }} - sourceRunId: ${{ github.event.workflow_run.id }} - - label-precommit: - name: Label pre-commit status - runs-on: ubuntu-20.04 - if: ${{ github.event.workflow.name == 'Pre-commit consistency check' }} - needs: - - get-info - steps: - - uses: getsentry/action-github-app-token@v1 - id: get-app-token - with: - app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} - private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} - - uses: hmarr/debug-action@v2 + # - name: "Get information about the origin 'CI' run" + # uses: potiuk/get-workflow-origin@v1_3 + # id: source-run-info + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # sourceRunId: ${{ github.event.workflow_run.id }} - # # CI Passed - # - name: "add label: ok" - # uses: actions-ecosystem/action-add-labels@v1 - # if: ${{ github.event.workflow_run.conclusion == 'success' }} - # with: - # github_token: ${{ steps.get-app-token.outputs.token }} - # labels: "precommit:ok" + # label-precommit: + # name: Label pre-commit status + # runs-on: ubuntu-20.04 + # if: ${{ github.event.workflow.name == 'Pre-commit consistency check' }} + # needs: + # - get-info + # steps: + # - uses: getsentry/action-github-app-token@v1 + # id: get-app-token + # with: + # app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} + # private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} - # - name: "remove label: failed" - # uses: actions-ecosystem/action-remove-labels@v1 - # if: ${{ github.event.workflow_run.conclusion == 'success' }} - # with: - # github_token: ${{ steps.get-app-token.outputs.token }} - # labels: "precommit:failed" + # # CI Passed + # - name: "add label: ok" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok" - # # CI Failed - # - name: "add label: failed" - # uses: actions-ecosystem/action-add-labels@v1 - # if: ${{ github.event.workflow_run.conclusion == 'failure' }} - # with: - # github_token: ${{ steps.get-app-token.outputs.token }} - # labels: "precommit:failed" + # - name: "remove label: failed" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" - # - name: "remove label: ok" - # uses: actions-ecosystem/action-remove-labels@v1 - # if: ${{ github.event.workflow_run.conclusion == 'failure' }} - # with: - # github_token: ${{ steps.get-app-token.outputs.token }} - # labels: "precommit:ok" + # # CI Failed + # - name: "add label: failed" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" + + # - name: "remove label: ok" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok" + + # label-lint: + # name: Label lint status + # runs-on: ubuntu-20.04 + # if: ${{ github.event.workflow.name == 'Pre-commit consistency check' }} + # needs: + # - get-info + # steps: + # - uses: getsentry/action-github-app-token@v1 + # id: get-app-token + # with: + # app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} + # private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} + + # # CI Passed + # - name: "add label: ok" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok" + + # - name: "remove label: failed" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" + + # # CI Failed + # - name: "add label: failed" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" + + # - name: "remove label: ok" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok" + + # label-precommit: + # name: Label pre-commit status + # runs-on: ubuntu-20.04 + # if: ${{ github.event.workflow.name == 'Pre-commit consistency check' }} + # needs: + # - get-info + # steps: + # - uses: getsentry/action-github-app-token@v1 + # id: get-app-token + # with: + # app_id: ${{ secrets.K8S_AT_HOME_APP_ID }} + # private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }} + + # # CI Passed + # - name: "add label: ok" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok" + + # - name: "remove label: failed" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" + + # # CI Failed + # - name: "add label: failed" + # uses: actions-ecosystem/action-add-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:failed" + + # - name: "remove label: ok" + # uses: actions-ecosystem/action-remove-labels@v1 + # if: ${{ github.event.workflow_run.conclusion == 'failure' }} + # with: + # github_token: ${{ steps.get-app-token.outputs.token }} + # number: ${{ needs.get-info.outputs.pullRequestNumber }} + # labels: "precommit:ok"