From 6fa729bc32fcc6ba4e608779acf4fd352a318ed8 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Mon, 17 Jul 2023 11:53:57 -0700 Subject: [PATCH 01/14] Upload unit test reports to datadog action (#480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an action that runs after the linux pipeline and looks for archived unit test reports. The reports are organized based on platform and shard: android-arm ├── 1 ... └── 4 linux-x64-x11 ├── 1 ... └── 4 etc. b/290997541 --- .github/workflows/unit_test_report.yaml | 85 +++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/unit_test_report.yaml diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml new file mode 100644 index 0000000000000..c79b390eeef79 --- /dev/null +++ b/.github/workflows/unit_test_report.yaml @@ -0,0 +1,85 @@ +name: Upload Unit Test Results + +on: + workflow_run: + workflows: + - linux + # TODO: Download xml files from GCS + # - android + # - raspi + # TODO: Generate xml files + # - win32 + # TODO: Get xml files from platforms + # - atv + # - ps + # - switch + # - xbox + types: + - completed + +jobs: + # Gets unit test report from artifact storage and uploads them to DataDog. + unit-test-report: + permissions: {} + if: always() + runs-on: ubuntu-latest + name: Upload Unit Test Reports + env: + DATADOG_API_KEY: ${{ secrets.DD_API_KEY }} + DATADOG_SITE: us5.datadoghq.com + steps: + - name: Collect Unit Test Reports + id: collect-report + uses: actions/github-script@v6.4.1 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{github.event.workflow_run.id }}, + }); + var results = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "unit-test-results" + }); + if (results.length == 0) { + // No reports to upload. + return false; + } + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: results.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/unit-test-results.zip', Buffer.from(download.data)); + return true; + - run: unzip unit-test-results.zip -d unit-test-results + if: steps.collect-report.outputs.result + - name: Install node + if: steps.collect-report.outputs.result + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Get Datadog CLI + if: steps.collect-report.outputs.result + shell: bash + # TODO: pin version (with checksum?) + run: npm install -g @datadog/datadog-ci + - name: Upload the JUnit files + if: steps.collect-report.outputs.result + shell: bash + run: | + # Loop over platform folders in archive + for dir in unit-test-results/*/; do + echo "Uploading $dir test report" + + service="${{ github.event.repository.name }}" + tags=`cat ${dir}TAGS` + + datadog-ci junit upload \ + --service $service \ + --env ci \ + --tags $tags \ + $dir + done From 6d01dc86f38e048664409137fec48b4dde0ce1a9 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Mon, 17 Jul 2023 15:00:36 -0700 Subject: [PATCH 02/14] Update script action version and code (#482) Some api changes and better variable naming. b/290997541 --- .github/workflows/unit_test_report.yaml | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index c79b390eeef79..7abce90684895 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -30,29 +30,29 @@ jobs: steps: - name: Collect Unit Test Reports id: collect-report - uses: actions/github-script@v6.4.1 + uses: actions/github-script@v6 with: script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, }); - var results = artifacts.data.artifacts.filter((artifact) => { + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { return artifact.name == "unit-test-results" }); - if (results.length == 0) { - // No reports to upload. + if (matchArtifact.length == 0) { + // No reports were uploaded. return false; } - var download = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: results.id, - archive_format: 'zip', + let 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}}/unit-test-results.zip', Buffer.from(download.data)); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`, Buffer.from(download.data)); return true; - run: unzip unit-test-results.zip -d unit-test-results if: steps.collect-report.outputs.result From 6cc3a0d439936327b50f14c2af1be73da83dc8ed Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Mon, 17 Jul 2023 15:51:59 -0700 Subject: [PATCH 03/14] Add workflow to trigger uploader faster (#483) --- .github/workflows/testing.yaml | 31 +++++++++++++++++++++++++ .github/workflows/unit_test_report.yaml | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/testing.yaml diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml new file mode 100644 index 0000000000000..0e9d19d15c1e9 --- /dev/null +++ b/.github/workflows/testing.yaml @@ -0,0 +1,31 @@ +name: testing + +on: + pull_request: + types: [opened, reopened, synchronize, labeled] + branches: + - main + - feature/* + push: + branches: + - main + - feature/* + workflow_dispatch: + inputs: + nightly: + description: 'Nightly workflow.' + required: true + type: boolean + default: false + +jobs: + linux-x64: + runs-on: ubuntu-latest + steps: + - name: Archive unit test report + uses: actions/upload-artifact@v3 + # TODO: Should only run for unit-tests + if: always() + with: + name: unit-test-results + path: unit-test-results/ diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 7abce90684895..44bcd69bfca76 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -4,6 +4,8 @@ on: workflow_run: workflows: - linux + # TODO: Temporary testing + - testing # TODO: Download xml files from GCS # - android # - raspi From e179bac2df52c311166927131c9137a69dd326d2 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Mon, 17 Jul 2023 16:57:21 -0700 Subject: [PATCH 04/14] Check out source code before trying to archive files (#484) b/290997541 --- .github/workflows/testing.yaml | 4 ++++ .github/workflows/unit_test_report.yaml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 0e9d19d15c1e9..f5a13627d238b 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -22,6 +22,10 @@ jobs: linux-x64: runs-on: ubuntu-latest steps: + - name: Checkout + uses: kaidokert/checkout@v3.5.999 + with: + fetch-depth: 1 - name: Archive unit test report uses: actions/upload-artifact@v3 # TODO: Should only run for unit-tests diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 44bcd69bfca76..4bd76c38bb14f 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -35,6 +35,7 @@ jobs: uses: actions/github-script@v6 with: script: | + console.log(context); let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, @@ -45,6 +46,7 @@ jobs: }); if (matchArtifact.length == 0) { // No reports were uploaded. + console.log('No unit test reports were uploaded'); return false; } let download = await github.rest.actions.downloadArtifact({ @@ -55,6 +57,7 @@ jobs: }); let fs = require('fs'); fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`, Buffer.from(download.data)); + console.log(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`); return true; - run: unzip unit-test-results.zip -d unit-test-results if: steps.collect-report.outputs.result From 9e87aaacae26c90ad3e91a45232c538143fa49ee Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 10:20:21 -0700 Subject: [PATCH 05/14] Fix array indexing, more logging (#486) b/290997541 --- .github/workflows/unit_test_report.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 4bd76c38bb14f..7c3481bee468e 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -41,10 +41,12 @@ jobs: repo: context.repo.repo, run_id: context.payload.workflow_run.id, }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + console.log(allArtifacts); + let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { return artifact.name == "unit-test-results" }); - if (matchArtifact.length == 0) { + console.log(matchArtifacts) + if (matchArtifacts.length == 0) { // No reports were uploaded. console.log('No unit test reports were uploaded'); return false; @@ -52,7 +54,7 @@ jobs: let download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, - artifact_id: matchArtifact.id, + artifact_id: matchArtifacts[0].id, archive_format: 'zip', }); let fs = require('fs'); From a0c04b705773cf8695821145446331a587d6bee3 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 11:00:02 -0700 Subject: [PATCH 06/14] Use correct syntax (#487) b/290997541 --- .github/workflows/unit_test_report.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 7c3481bee468e..d29cf0a91ff22 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -62,19 +62,19 @@ jobs: console.log(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`); return true; - run: unzip unit-test-results.zip -d unit-test-results - if: steps.collect-report.outputs.result + if: ${{ steps.collect-report.outputs.result == 'true' }} - name: Install node if: steps.collect-report.outputs.result uses: actions/setup-node@v3 with: node-version: 16 - name: Get Datadog CLI - if: steps.collect-report.outputs.result + if: ${{ steps.collect-report.outputs.result == 'true' }} shell: bash # TODO: pin version (with checksum?) run: npm install -g @datadog/datadog-ci - name: Upload the JUnit files - if: steps.collect-report.outputs.result + if: ${{ steps.collect-report.outputs.result == 'true' }} shell: bash run: | # Loop over platform folders in archive From b1dffbedcb9e6fc0bb79018c96c8950087606078 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 13:17:33 -0700 Subject: [PATCH 07/14] Move env, more logging (#488) b/290997541 --- .github/workflows/unit_test_report.yaml | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index d29cf0a91ff22..6a5c4be9a69a3 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -26,16 +26,16 @@ jobs: if: always() runs-on: ubuntu-latest name: Upload Unit Test Reports - env: - DATADOG_API_KEY: ${{ secrets.DD_API_KEY }} - DATADOG_SITE: us5.datadoghq.com steps: - name: Collect Unit Test Reports id: collect-report uses: actions/github-script@v6 with: script: | - console.log(context); + console.log('context', context); + console.log('context.payload.workflow_run.pull_requests', context.payload.workflow_run.pull_requests); + console.log('context.payload.workflow_run.head_commit', context.payload.workflow_run.head_commit); + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, @@ -59,7 +59,6 @@ jobs: }); let fs = require('fs'); fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`, Buffer.from(download.data)); - console.log(`${process.env.GITHUB_WORKSPACE}/unit-test-results.zip`); return true; - run: unzip unit-test-results.zip -d unit-test-results if: ${{ steps.collect-report.outputs.result == 'true' }} @@ -76,17 +75,24 @@ jobs: - name: Upload the JUnit files if: ${{ steps.collect-report.outputs.result == 'true' }} shell: bash + env: + DATADOG_API_KEY: ${{ secrets.DD_API_KEY }} + DATADOG_SITE: us5.datadoghq.com + DD_ENV: ci + DD_SERVICE: ${{ github.event.repository.name }} + # TODO + # DD_METRICS: + + DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} + DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }} run: | - # Loop over platform folders in archive + for dir in unit-test-results/*/; do echo "Uploading $dir test report" - service="${{ github.event.repository.name }}" tags=`cat ${dir}TAGS` datadog-ci junit upload \ - --service $service \ - --env ci \ --tags $tags \ - $dir + $dir/** done From 9af3ea616db5ba73a0015449e9c7ad7281aa20b9 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 13:47:39 -0700 Subject: [PATCH 08/14] Fix glob (#489) b/290997541 --- .github/workflows/unit_test_report.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 6a5c4be9a69a3..3f8ec1d678c7a 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -94,5 +94,5 @@ jobs: datadog-ci junit upload \ --tags $tags \ - $dir/** + $dir/**/*.xml done From 900d25e1ecb318fe7fcec4ed72ae7b021d10140f Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 13:50:58 -0700 Subject: [PATCH 09/14] Add a bunch of TODOs b/290997541 --- .github/workflows/unit_test_report.yaml | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 3f8ec1d678c7a..f9fe149530c8d 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -85,6 +85,36 @@ jobs: DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }} + + # DD_GIT_BRANCH: + + # DD_GIT_COMMIT_MESSAGE + # Commit message. + # Example: Set release number + + # DD_GIT_COMMIT_AUTHOR_NAME + # Commit author name. + # Example: John Smith + + # DD_GIT_COMMIT_AUTHOR_EMAIL + # Commit author email. + # Example: john@example.com + + # DD_GIT_COMMIT_AUTHOR_DATE + # Commit author date in ISO 8601 format. + # Example: 2021-03-12T16:00:28Z + + # DD_GIT_COMMIT_COMMITTER_NAME + # Commit committer name. + # Example: Jane Smith + + # DD_GIT_COMMIT_COMMITTER_EMAIL + # Commit committer email. + # Example: jane@example.com + + # DD_GIT_COMMIT_COMMITTER_DATE + # Commit committer date in ISO 8601 format. + # Example: 2021-03-12T16:00:28Z run: | for dir in unit-test-results/*/; do From 6693f64d8b84ce990a7f1f91fd923b397790b463 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Tue, 18 Jul 2023 21:03:10 -0700 Subject: [PATCH 10/14] Explain folder structure in comment b/290997541 --- .github/workflows/unit_test_report.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index f9fe149530c8d..667eee0a68527 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -116,7 +116,24 @@ jobs: # Commit committer date in ISO 8601 format. # Example: 2021-03-12T16:00:28Z run: | + # Unit test results are archived on the following format: + # + # unit-test-results/ + # ├── android-arm + # │ ├── + # │ │ └── + # │ └── TAGS + # ├── linux-x64x11 + # │ ├── + # │ │ └── + # │ └── TAGS + # ├── raspi-2 + # │ ├── + # │ │ └── + # │ └── TAGS + # etc. + # Loop over each platform, extract the tags and upload xml results. for dir in unit-test-results/*/; do echo "Uploading $dir test report" From 758f46c94e4c5f13937b1172dae9498dc602e7a6 Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Wed, 19 Jul 2023 11:42:24 -0700 Subject: [PATCH 11/14] Add clarifying comments b/290997541 --- .github/workflows/unit_test_report.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 667eee0a68527..380b703403010 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -1,6 +1,8 @@ name: Upload Unit Test Results on: + # This workflow must be triggered via `workflow_run` to be able to access + # secrets, which is not possible from a workflow triggered by a PR in a fork. workflow_run: workflows: - linux @@ -36,6 +38,12 @@ jobs: console.log('context.payload.workflow_run.pull_requests', context.payload.workflow_run.pull_requests); console.log('context.payload.workflow_run.head_commit', context.payload.workflow_run.head_commit); + // The `download-artifact` action can only access artifacts that + // were uploaded in the same workflow. Since it was not this + // workflow that uploaded the artifacts we must use rest api + // to download them. + // https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, @@ -83,6 +91,7 @@ jobs: # TODO # DD_METRICS: + # Git info DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }} From dfdf1bf6a3025cea559f3135e3ca2029db19da3c Mon Sep 17 00:00:00 2001 From: Oscar Vestlie Date: Wed, 19 Jul 2023 15:56:02 -0700 Subject: [PATCH 12/14] Populate git metadata b/290997541 --- .github/workflows/unit_test_report.yaml | 41 ++++++------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 380b703403010..6d61cb5440c87 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -92,38 +92,17 @@ jobs: # DD_METRICS: # Git info - DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }} - - # DD_GIT_BRANCH: - - # DD_GIT_COMMIT_MESSAGE - # Commit message. - # Example: Set release number - - # DD_GIT_COMMIT_AUTHOR_NAME - # Commit author name. - # Example: John Smith - - # DD_GIT_COMMIT_AUTHOR_EMAIL - # Commit author email. - # Example: john@example.com - - # DD_GIT_COMMIT_AUTHOR_DATE - # Commit author date in ISO 8601 format. - # Example: 2021-03-12T16:00:28Z - - # DD_GIT_COMMIT_COMMITTER_NAME - # Commit committer name. - # Example: Jane Smith - - # DD_GIT_COMMIT_COMMITTER_EMAIL - # Commit committer email. - # Example: jane@example.com - - # DD_GIT_COMMIT_COMMITTER_DATE - # Commit committer date in ISO 8601 format. - # Example: 2021-03-12T16:00:28Z + DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} + DD_GIT_BRANCH: ${{ github.event.workflow_run.head_branch }} + DD_GIT_COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }} + DD_GIT_COMMIT_AUTHOR_NAME: ${{ github.event.workflow_run.head_commit.author.name }} + DD_GIT_COMMIT_AUTHOR_EMAIL: ${{ github.event.workflow_run.head_commit.author.email }} + DD_GIT_COMMIT_AUTHOR_DATE: ${{ github.event.workflow_run.head_commit.timestamp }} + DD_GIT_COMMIT_COMMITTER_NAME: ${{ github.event.workflow_run.head_commit.committer.name }} + DD_GIT_COMMIT_COMMITTER_EMAIL: ${{ github.event.workflow_run.head_commit.committer.email }} + # TODO: Not available? + DD_GIT_COMMIT_COMMITTER_DATE: ${{ github.event.workflow_run.head_commit.timestamp }} run: | # Unit test results are archived on the following format: # From 928f9526cb25448ea7bd4079b249eaddccca8ea1 Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Thu, 20 Jul 2023 09:39:55 -0400 Subject: [PATCH 13/14] Test PR labeling (internal) (#466) --- .github/workflows/auto_label_pr.yaml | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/auto_label_pr.yaml diff --git a/.github/workflows/auto_label_pr.yaml b/.github/workflows/auto_label_pr.yaml new file mode 100644 index 0000000000000..a8acac8edc840 --- /dev/null +++ b/.github/workflows/auto_label_pr.yaml @@ -0,0 +1,35 @@ +name: PR Auto Label + +on: + pull_request_target: + types: + - opened + - reopened + +concurrency: + group: '${{ github.workflow }}-${{ github.event_name }} @ ${{ github.event.pull_request.number || github.sha }}' + cancel-in-progress: true + +jobs: + assign-reviewer: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Check if PR author is outside collaborator and assign reviewer + env: + PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }} + REPO_NAME: ${{ github.event.repository.full_name }} + PR_NUMBER: ${{ github.event.number }} + run: | + PERMISSION_LEVEL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/$REPO_NAME/collaborators/$PR_AUTHOR_LOGIN/permission" | jq -r .role_name) + + if [ "$PERMISSION_LEVEL" == "none" ] || [ "$PERMISSION_LEVEL" == "read" ]; then + echo "PR author is an outside collaborator. Adding label..." + + curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d '["outside collaborator"]' \ + "https://api.github.com/repos/$REPO_NAME/issues/$PR_NUMBER/labels" + fi From 4d4b8ad7a9e91e5c2a7c2956c9439367f659cb30 Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Thu, 20 Jul 2023 06:41:49 -0700 Subject: [PATCH 14/14] Test external change for PR labels --- starboard_configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starboard_configuration.py b/starboard_configuration.py index cff729480694d..9d378fedafd33 100644 --- a/starboard_configuration.py +++ b/starboard_configuration.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License.""" """Definition of interface used by host apps to configure Starboard""" - +# Test change from cobalt.build import cobalt_configuration # List of paths to directories in which Starboard ports are located. Each path