Skip to content

Commit 203e39d

Browse files
ci: remove pull_request_target trigger (#613)
1 parent c4eb455 commit 203e39d

5 files changed

Lines changed: 94 additions & 126 deletions

File tree

.github/labels.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,60 +15,60 @@
1515
- name: duplicate
1616
color: ededed
1717
description: ""
18-
- name: 'type: bug'
18+
- name: "type: bug"
1919
color: db4437
2020
description: Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
21-
- name: 'type: cleanup'
21+
- name: "type: cleanup"
2222
color: c5def5
2323
description: An internal cleanup or hygiene concern.
24-
- name: 'type: docs'
24+
- name: "type: docs"
2525
color: 0000A0
2626
description: Improvement to the documentation for an API.
27-
- name: 'type: feature request'
27+
- name: "type: feature request"
2828
color: c5def5
2929
description: ‘Nice-to-have’ improvement, new feature or different behavior or design.
30-
- name: 'type: process'
30+
- name: "type: process"
3131
color: c5def5
3232
description: A process-related concern. May include testing, release, or the like.
33-
- name: 'type: question'
33+
- name: "type: question"
3434
color: c5def5
3535
description: Request for information or clarification.
36-
- name: 'priority: p0'
36+
- name: "priority: p0"
3737
color: b60205
3838
description: Highest priority. Critical issue. P0 implies highest priority.
39-
- name: 'priority: p1'
39+
- name: "priority: p1"
4040
color: ffa03e
4141
description: Important issue which blocks shipping the next release. Will be fixed prior to next release.
42-
- name: 'priority: p2'
42+
- name: "priority: p2"
4343
color: fef2c0
4444
description: Moderately-important priority. Fix may not be included in next release.
45-
- name: 'priority: p3'
45+
- name: "priority: p3"
4646
color: ffffc7
4747
description: Desirable enhancement or fix. May not be included in next release.
4848
- name: do not merge
4949
color: d93f0b
5050
description: Indicates a pull request not ready for merge, due to either quality or timing.
51-
- name: 'autorelease: pending'
51+
- name: "autorelease: pending"
5252
color: ededed
5353
description: Release please needs to do its work on this.
54-
- name: 'autorelease: triggered'
54+
- name: "autorelease: triggered"
5555
color: ededed
5656
description: Release please has triggered a release for this.
57-
- name: 'autorelease: tagged'
57+
- name: "autorelease: tagged"
5858
color: ededed
5959
description: Release please has completed a release for this.
60-
- name: 'tests: run'
60+
- name: "tests: run"
6161
color: 3DED97
6262
description: Label to trigger Github Action tests.
63-
- name: 'tests: run-unit'
63+
- name: "tests: run-unit"
6464
color: 3DED97
6565
description: Label to trigger Github Action unit tests.
66-
- name: 'flakybot: flaky'
66+
- name: "flakybot: flaky"
6767
color: 86d9d7
6868
description: Tells the Flaky Bot not to close or comment on this issue.
69-
- name: 'flakybot: quiet'
69+
- name: "flakybot: quiet"
7070
color: 86d9d7
7171
description: Tells the Flaky Bot to comment less.
72-
- name: 'flakybot: issue'
72+
- name: "flakybot: issue"
7373
color: a9f9f7
7474
description: An issue filed by the Flaky Bot. Should not be added manually.

.github/trusted-contribution.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ annotations:
1616
- type: label
1717
text: "tests: run-unit"
1818

19-
trustedContributors: ['renovate-bot', 'gcf-merge-on-green[bot]']
19+
trustedContributors: ["renovate-bot", "gcf-merge-on-green[bot]"]

.github/workflows/codeql.yml

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,18 @@ name: "CodeQL"
1616

1717
on:
1818
push:
19-
branches: [ "main" ]
19+
branches: ["main"]
2020
pull_request:
21-
branches: [ "main" ]
21+
branches: ["main"]
2222
paths-ignore:
23-
- '**/*.md'
24-
- '**/*.txt'
25-
pull_request_target:
26-
types: [labeled]
27-
paths-ignore:
28-
- '**/*.md'
29-
- '**/*.txt'
23+
- "**/*.md"
24+
- "**/*.txt"
3025

3126
# Declare default permissions as read only.
3227
permissions: read-all
3328

3429
jobs:
3530
analyze:
36-
if: "${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' }}"
3731
name: Analyze
3832
runs-on: ubuntu-latest
3933
permissions:
@@ -44,33 +38,30 @@ jobs:
4438
strategy:
4539
fail-fast: false
4640
matrix:
47-
language: [ 'go' ]
41+
language: ["go"]
4842

4943
steps:
50-
- name: Checkout repository
51-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
52-
with:
53-
ref: ${{ github.event.pull_request.head.sha }}
54-
repository: ${{ github.event.pull_request.head.repo.full_name }}
44+
- name: Checkout repository
45+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
5546

56-
- name: Setup Go
57-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
58-
with:
59-
go-version: "1.22"
60-
if: ${{ matrix.language == 'go' }}
47+
- name: Setup Go
48+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
49+
with:
50+
go-version: "1.22"
51+
if: ${{ matrix.language == 'go' }}
6152

62-
# Initializes the CodeQL tools for scanning.
63-
- name: Initialize CodeQL
64-
uses: github/codeql-action/init@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
65-
with:
66-
languages: ${{ matrix.language }}
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
56+
with:
57+
languages: ${{ matrix.language }}
6758

68-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
69-
# If this step fails, then you should remove it and run the build manually
70-
- name: Autobuild
71-
uses: github/codeql-action/autobuild@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
59+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
60+
# If this step fails, then you should remove it and run the build manually
61+
- name: Autobuild
62+
uses: github/codeql-action/autobuild@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
7263

73-
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
75-
with:
76-
category: "/language:${{matrix.language}}"
64+
- name: Perform CodeQL Analysis
65+
uses: github/codeql-action/analyze@a073c66b2accf653a511d88537804dcafa07812e # v2.25.10
66+
with:
67+
category: "/language:${{matrix.language}}"

.github/workflows/tests-main.yaml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ on: # at 5:10 UTC every day and on each push to main
1818
- cron: "10 5 * * *"
1919
push:
2020
branches:
21-
- 'main'
21+
- "main"
2222
permissions: read-all
2323
jobs:
2424
unit:
2525
name: unit tests
2626
runs-on: ubuntu-latest
2727
permissions:
28-
contents: 'read'
29-
id-token: 'write'
28+
contents: "read"
29+
id-token: "write"
3030
steps:
3131
- name: Checkout code
3232
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
33-
- id: 'auth'
33+
- id: auth
3434
name: Authenticate to Google Cloud
3535
uses: google-github-actions/auth@3a3c4c57d294ef65efaaee4ff17b22fa88dd3c69 # v1.3.0
3636
with:
37-
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
38-
service_account: ${{ secrets.SERVICE_ACCOUNT }}
37+
workload_identity_provider: ${{ vars.PROVIDER_NAME }}
38+
service_account: ${{ vars.SERVICE_ACCOUNT }}
3939
access_token_lifetime: 600s
40-
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
4140
- name: Setup Go
4241
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
4342
with:
@@ -66,42 +65,48 @@ jobs:
6665
name: e2e tests
6766
runs-on: ubuntu-latest
6867
permissions:
69-
contents: 'read'
70-
id-token: 'write'
68+
contents: read
69+
id-token: write
7170
steps:
7271
- name: Checkout code
7372
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
74-
- id: 'auth'
75-
name: 'Authenticate to Google Cloud'
73+
- id: auth
74+
name: Authenticate to Google Cloud
7675
uses: google-github-actions/auth@3a3c4c57d294ef65efaaee4ff17b22fa88dd3c69 # v1.3.0
7776
with:
78-
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
79-
service_account: ${{ secrets.SERVICE_ACCOUNT }}
77+
workload_identity_provider: ${{ vars.PROVIDER_NAME }}
78+
service_account: ${{ vars.SERVICE_ACCOUNT }}
8079
access_token_lifetime: 600s
81-
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
82-
create_credentials_file: true
83-
- name: 'Set up Cloud SDK'
80+
- id: secrets
81+
name: Get secrets
82+
uses: google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
83+
with:
84+
secrets: |-
85+
NODEPOOL_SERVICEACCOUNT_EMAIL:${{ vars.GOOGLE_CLOUD_PROJECT }}/NODEPOOL_SERVICEACCOUNT_EMAIL
86+
TFSTATE_STORAGE_BUCKET:${{ vars.GOOGLE_CLOUD_PROJECT }}/TFSTATE_STORAGE_BUCKET
87+
WORKLOAD_ID_SERVICEACCOUNT_EMAIL:${{ vars.GOOGLE_CLOUD_PROJECT }}/WORKLOAD_ID_SERVICEACCOUNT_EMAIL
88+
- name: Set up Cloud SDK
8489
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1
85-
- name: 'Setup Go'
90+
- name: "Setup Go"
8691
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
8792
with:
8893
go-version: "1.22"
8994
- name: Set up QEMU
9095
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
9196
- name: Set up Docker Buildx
9297
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
93-
- id: 'e2e'
94-
name: 'Run E2E Tests'
98+
- id: e2e
99+
name: Run E2E Tests
95100
run: "./tools/e2e_test_job.sh"
96101
# specifying bash shell ensures a failure in a piped process isn't lost
97102
# by using `set -eo pipefail`
98103
shell: bash
99104
env:
100105
ENVIRONMENT_NAME: "ci-branch-main"
101-
NODEPOOL_SERVICEACCOUNT_EMAIL: "${{secrets.NODEPOOL_SERVICEACCOUNT_EMAIL}}"
102-
WORKLOAD_ID_SERVICEACCOUNT_EMAIL: "${{secrets.WORKLOAD_ID_SERVICEACCOUNT_EMAIL}}"
103-
TFSTATE_STORAGE_BUCKET: "${{secrets.TFSTATE_STORAGE_BUCKET}}"
104-
E2E_PROJECT_ID: "${{secrets.GOOGLE_CLOUD_PROJECT}}"
106+
NODEPOOL_SERVICEACCOUNT_EMAIL: "${{ steps.secrets.outputs.NODEPOOL_SERVICEACCOUNT_EMAIL }}"
107+
WORKLOAD_ID_SERVICEACCOUNT_EMAIL: "${{ steps.secrets.outputs.WORKLOAD_ID_SERVICEACCOUNT_EMAIL }}"
108+
TFSTATE_STORAGE_BUCKET: "${{ steps.secrets.outputs.TFSTATE_STORAGE_BUCKET }}"
109+
E2E_PROJECT_ID: "${{vars.GOOGLE_CLOUD_PROJECT}}"
105110
- name: Convert test output to XML
106111
if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() }}
107112
run: |

.github/workflows/tests.yaml

Lines changed: 22 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,17 @@
1414

1515
name: tests
1616
on:
17+
# Add labeled type to defaults
1718
pull_request:
18-
pull_request_target:
19-
types: [labeled]
19+
types: [opened, synchronize, reopened, labeled]
2020
# Declare default permissions as read only.
2121
permissions: read-all
2222
jobs:
2323
unit:
2424
if: "${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' || github.event.label.name == 'tests: run-unit' }}"
2525
name: unit tests
2626
runs-on: ubuntu-latest
27-
permissions:
28-
issues: write
29-
pull-requests: write
3027
steps:
31-
- name: Remove PR Label
32-
if: "${{ github.event.action == 'labeled' && (github.event.label.name == 'tests: run' || github.event.label.name == 'tests: run-unit') }}"
33-
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
34-
with:
35-
github-token: ${{ secrets.GITHUB_TOKEN }}
36-
script: |
37-
try {
38-
await github.rest.issues.removeLabel({
39-
name: 'tests: run',
40-
owner: context.repo.owner,
41-
repo: context.repo.repo,
42-
issue_number: context.payload.pull_request.number
43-
});
44-
} catch (e) {
45-
console.log('Failed to remove label. Another job may have already removed it!');
46-
}
47-
try {
48-
await github.rest.issues.removeLabel({
49-
name: 'tests: run-unit',
50-
owner: context.repo.owner,
51-
repo: context.repo.repo,
52-
issue_number: context.payload.pull_request.number
53-
});
54-
} catch (e) {
55-
console.log('Failed to remove label. Another job may have already removed it!');
56-
}
5728
- name: Setup Go
5829
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
5930
with:
@@ -73,41 +44,42 @@ jobs:
7344
name: e2e tests
7445
runs-on: ubuntu-latest
7546
permissions:
76-
contents: 'read'
77-
id-token: 'write'
78-
issues: write
79-
pull-requests: write
47+
contents: read
48+
id-token: write
8049
steps:
8150
- name: Checkout code
8251
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
83-
with:
84-
ref: ${{ github.event.pull_request.head.sha }}
85-
repository: ${{ github.event.pull_request.head.repo.full_name }}
86-
- id: 'auth'
52+
- id: auth
8753
name: Authenticate to Google Cloud
8854
uses: google-github-actions/auth@3a3c4c57d294ef65efaaee4ff17b22fa88dd3c69 # v1.3.0
8955
with:
90-
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
91-
service_account: ${{ secrets.SERVICE_ACCOUNT }}
56+
workload_identity_provider: ${{ vars.PROVIDER_NAME }}
57+
service_account: ${{ vars.SERVICE_ACCOUNT }}
9258
access_token_lifetime: 600s
93-
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
94-
create_credentials_file: true
59+
- id: secrets
60+
name: Get secrets
61+
uses: google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
62+
with:
63+
secrets: |-
64+
NODEPOOL_SERVICEACCOUNT_EMAIL:${{ vars.GOOGLE_CLOUD_PROJECT }}/NODEPOOL_SERVICEACCOUNT_EMAIL
65+
TFSTATE_STORAGE_BUCKET:${{ vars.GOOGLE_CLOUD_PROJECT }}/TFSTATE_STORAGE_BUCKET
66+
WORKLOAD_ID_SERVICEACCOUNT_EMAIL:${{ vars.GOOGLE_CLOUD_PROJECT }}/WORKLOAD_ID_SERVICEACCOUNT_EMAIL
9567
- name: Set up Cloud SDK
9668
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1
97-
- name: 'Setup Go'
69+
- name: Setup Go
9870
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
9971
with:
10072
go-version: "1.22"
10173
- name: Set up QEMU
10274
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
10375
- name: Set up Docker Buildx
10476
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
105-
- id: 'e2e'
106-
name: 'Run E2E Tests'
77+
- id: e2e
78+
name: "Run E2E Tests"
10779
run: "./tools/e2e_test_job.sh"
10880
env:
10981
ENVIRONMENT_NAME: "ci-pr"
110-
NODEPOOL_SERVICEACCOUNT_EMAIL: "${{secrets.NODEPOOL_SERVICEACCOUNT_EMAIL}}"
111-
WORKLOAD_ID_SERVICEACCOUNT_EMAIL: "${{secrets.WORKLOAD_ID_SERVICEACCOUNT_EMAIL}}"
112-
TFSTATE_STORAGE_BUCKET: "${{secrets.TFSTATE_STORAGE_BUCKET}}"
113-
E2E_PROJECT_ID: "${{secrets.GOOGLE_CLOUD_PROJECT}}"
82+
NODEPOOL_SERVICEACCOUNT_EMAIL: "${{ steps.secrets.outputs.NODEPOOL_SERVICEACCOUNT_EMAIL }}"
83+
WORKLOAD_ID_SERVICEACCOUNT_EMAIL: "${{ steps.secrets.outputs.WORKLOAD_ID_SERVICEACCOUNT_EMAIL }}"
84+
TFSTATE_STORAGE_BUCKET: "${{ steps.secrets.outputs.TFSTATE_STORAGE_BUCKET }}"
85+
E2E_PROJECT_ID: "${{vars.GOOGLE_CLOUD_PROJECT}}"

0 commit comments

Comments
 (0)