From 462e303c088efe97211197c1eecb260b576ee9fe Mon Sep 17 00:00:00 2001 From: Otavio Rodolfo Piske Date: Tue, 7 Jan 2025 15:41:39 +0100 Subject: [PATCH] (chores) ci: removed test result comments from Camel 3 automation --- .github/workflows/component-pr.yaml | 101 +--------------------------- 1 file changed, 1 insertion(+), 100 deletions(-) diff --git a/.github/workflows/component-pr.yaml b/.github/workflows/component-pr.yaml index 7aae4375c6579..9a243dc966d5e 100644 --- a/.github/workflows/component-pr.yaml +++ b/.github/workflows/component-pr.yaml @@ -26,10 +26,6 @@ on: - 'parent/**' - 'core/**' - 'components/**' - workflow_run: - workflows: [ "PR Build (Camel 3.x)" ] - types: - - completed permissions: {} jobs: @@ -70,99 +66,4 @@ jobs: * :warning: Be careful when sharing logs. Review their contents before sharing them publicly.` - }) - - name: 'Download artifact' - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - if: | - github.event_name == 'workflow_run' - with: -# Secure download based on: -# - https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ -# - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run - script: | - var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "test-logs" - })[0]; - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/test-logs.zip', Buffer.from(download.data)); - - run: unzip test-logs.zip - if: | - github.event_name == 'workflow_run' - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - if: | - github.event_name == 'workflow_run' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); - let componentsTotal = Number(fs.readFileSync('./components-total')); - let componentsTested = Number(fs.readFileSync('./components-tested')); - let componentsFailures = Number(fs.readFileSync('./components-failures')); - let componentsSuccesses = Number(fs.readFileSync('./components-successes')); - - var message = "" - - if (componentsTested === 0) { - if (componentsTotal === 0) { - message = ":no_entry_sign: There are (likely) no components to be tested in this PR" - } else { - if (componentsTotal > 20) { - message = `:leftwards_arrow_with_hook: There are either **too many** changes to be tested in this PR or the code **needs be rebased**: (${componentsTotal} components likely to be affected)` - } - } - } else { - message = `### Components test results: - - | Total | Tested | Failed :x: | Passed :white_check_mark: | - | --- | --- | --- | --- | - | ${componentsTotal} | ${componentsTested} | ${componentsFailures} | ${componentsSuccesses} |` - } - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: message - }); - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - if: | - github.event_name == 'workflow_run' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); - let coreTested = Number(fs.readFileSync('./core-tested')); - let coreFailures = Number(fs.readFileSync('./core-failures')); - let coreSuccesses = Number(fs.readFileSync('./core-successes')); - - var message = "" - - if (coreTested === 0) { - message = ":no_entry_sign: There are (likely) no changes in core core to be tested in this PR" - } else { - message = `### Core test results: - - | Tested | Failed :x: | Passed :white_check_mark: | - | --- | --- | --- | - | ${coreTested} | ${coreFailures} | ${coreSuccesses} |` - } - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: message - }); + }) \ No newline at end of file