From 849709775d191aeb4dae5dd08545848960cdd2f9 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:03:17 +0200 Subject: [PATCH] ci: Fix CI checks for forks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs --- .github/workflows/charts-lint-test.yaml | 87 ------------------- .../metadata-label-pr-ci-status.yaml | 53 +++++++++++ .github/workflows/pre-commit-check.yaml | 37 -------- 3 files changed, 53 insertions(+), 124 deletions(-) create mode 100644 .github/workflows/metadata-label-pr-ci-status.yaml diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml index 00bb3189..6997fe6a 100644 --- a/.github/workflows/charts-lint-test.yaml +++ b/.github/workflows/charts-lint-test.yaml @@ -92,16 +92,9 @@ jobs: name: Lint charts runs-on: ubuntu-20.04 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: Checkout uses: actions/checkout@v2 with: - token: ${{ steps.get-app-token.outputs.token }} fetch-depth: 0 - name: Install Helm @@ -120,52 +113,15 @@ jobs: id: lint run: ct lint --config .github/ct-lint.yaml - # CI Passed - - name: "add label: ok" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "lint:ok" - - - name: "remove label: failed" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "lint:failed" - - # CI Failed - - name: "add label: failed" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "lint:failed" - - - name: "remove label: ok" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "lint:ok" - unittest: needs: - lint name: Run unit tests runs-on: ubuntu-20.04 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: Checkout uses: actions/checkout@v2 with: - token: ${{ steps.get-app-token.outputs.token }} fetch-depth: 0 - name: Install Dev tools @@ -204,16 +160,9 @@ jobs: max-parallel: 15 runs-on: ubuntu-20.04 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: Checkout uses: actions/checkout@v2 with: - token: ${{ steps.get-app-token.outputs.token }} fetch-depth: 0 - name: Install Helm @@ -249,42 +198,6 @@ jobs: name: Install successful runs-on: ubuntu-20.04 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: Check install matrix status if: ${{ needs.changes-install.outputs.detected == 'true' && needs.install.result != 'success' }} run: exit 1 - - # CI Passed - - name: "add label: ok" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "install:ok" - - - name: "remove label: failed" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "install:failed" - - # CI Failed - - name: "add label: failed" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "install:failed" - - - name: "remove label: ok" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "install:ok" diff --git a/.github/workflows/metadata-label-pr-ci-status.yaml b/.github/workflows/metadata-label-pr-ci-status.yaml new file mode 100644 index 00000000..f286cda3 --- /dev/null +++ b/.github/workflows/metadata-label-pr-ci-status.yaml @@ -0,0 +1,53 @@ +--- +name: "Metadata: Label pull requests CI status" + +on: + workflow_run: + workflows: + - "Pre-commit consistency check" + types: + - completed + +jobs: + label-precommit: + name: Label pre-commit status + runs-on: ubuntu-20.04 + # if: ${{ github.event.workflow_run.conclusion == 'success' }} + 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 + + # # 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" + + # - 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 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: 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" diff --git a/.github/workflows/pre-commit-check.yaml b/.github/workflows/pre-commit-check.yaml index 2a5151a3..f6586ea8 100644 --- a/.github/workflows/pre-commit-check.yaml +++ b/.github/workflows/pre-commit-check.yaml @@ -13,16 +13,9 @@ jobs: name: Run pre-commit checks runs-on: ubuntu-20.04 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: Checkout uses: actions/checkout@v2 with: - token: ${{ steps.get-app-token.outputs.token }} fetch-depth: 0 - uses: dorny/paths-filter@v2 @@ -46,33 +39,3 @@ jobs: if: steps.filter.outputs.addedOrModified != 'true' with: extra_args: --all-files - - # CI Passed - - name: "add label: ok" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "precommit:ok" - - - name: "remove label: failed" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ success() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "precommit:failed" - - # CI Failed - - name: "add label: failed" - uses: actions-ecosystem/action-add-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "precommit:failed" - - - name: "remove label: ok" - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ failure() }} - with: - github_token: ${{ steps.get-app-token.outputs.token }} - labels: "precommit:ok"