From 7e244fc83303af5a4206785eaed316938e09a56d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 6 Jun 2022 11:37:48 +0100 Subject: [PATCH] Switch to composite actions for pr_details and sonarqube (#8729) * Switch to composite actions for pr_details and sonarqube * Bring back a reusable workflow for element-web stack sonarqube runs * Move sonarcloud.yml to the right repo * Fix Netlify run --- .github/workflows/netlify.yaml | 18 ++++++++---------- .github/workflows/sonarqube.yml | 22 ---------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml index b8298c7924..3b7b57c227 100644 --- a/.github/workflows/netlify.yaml +++ b/.github/workflows/netlify.yaml @@ -7,16 +7,8 @@ on: types: - completed jobs: - prdetails: - name: ℹ️ PR Details - if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' - uses: matrix-org/matrix-js-sdk/.github/workflows/pr_details.yml@develop - with: - owner: ${{ github.event.workflow_run.head_repository.owner.login }} - branch: ${{ github.event.workflow_run.head_branch }} - deploy: - needs: prdetails + if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' runs-on: ubuntu-latest steps: - name: 📝 Create Deployment @@ -31,6 +23,12 @@ jobs: Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts. + - id: prdetails + uses: matrix-org/pr-details-action@v1.1 + with: + owner: ${{ github.event.workflow_run.head_repository.owner.login }} + branch: ${{ github.event.workflow_run.head_branch }} + # There's a 'download artifact' action, but it hasn't been updated for the workflow_run action # (https://github.com/actions/download-artifact/issues/60) so instead we get this mess: - name: 📥 Download artifact @@ -50,7 +48,7 @@ jobs: # These don't work because we're in workflow_run enable-pull-request-comment: false enable-commit-comment: false - alias: pr${{ needs.prdetails.outputs.pr_id }} + alias: pr${{ steps.prdetails.outputs.pr_id }} env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 11660e68ba..a5360c64fb 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -8,30 +8,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }} cancel-in-progress: true jobs: - prdetails: - name: ℹ️ PR Details - if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' - uses: matrix-org/matrix-js-sdk/.github/workflows/pr_details.yml@develop - with: - owner: ${{ github.event.workflow_run.head_repository.owner.login }} - branch: ${{ github.event.workflow_run.head_branch }} - sonarqube: name: 🩻 SonarQube - needs: prdetails - # Only wait for prdetails if it isn't skipped - if: | - always() && - (needs.prdetails.result == 'success' || needs.prdetails.result == 'skipped') && - github.event.workflow_run.conclusion == 'success' uses: matrix-org/matrix-js-sdk/.github/workflows/sonarcloud.yml@develop - with: - repo: ${{ github.event.workflow_run.head_repository.full_name }} - pr_id: ${{ needs.prdetails.outputs.pr_id }} - head_branch: ${{ needs.prdetails.outputs.head_branch || github.event.workflow_run.head_branch }} - base_branch: ${{ needs.prdetails.outputs.base_branch }} - revision: ${{ github.event.workflow_run.head_sha }} - coverage_workflow_name: tests.yml - coverage_run_id: ${{ github.event.workflow_run.id }} secrets: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}