Skip to content

Commit c99b795

Browse files
Migrate to dd-octo-sts. (#3380)
1 parent 72eae7d commit c99b795

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Trust policy for creating releases on master branch
2+
# Restricted to master branch (protected ref) for security
3+
# Will be called in release.yml
4+
issuer: https://token.actions.githubusercontent.com
5+
subject: repo:DataDog/datadog-api-client-python:pull_request
6+
7+
claim_pattern:
8+
event_name: pull_request
9+
job_workflow_ref: DataDog/datadog-api-client-python/\.github/workflows/release\.yml@refs/heads/master
10+
repository: DataDog/datadog-api-client-python
11+
ref: refs/heads/master
12+
13+
permissions:
14+
contents: write

.github/workflows/approved_status.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ jobs:
2222
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
2323
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/') &&
2424
contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')
25+
permissions:
26+
id-token: write
2527
steps:
2628
- name: Get GitHub App token
2729
id: get_token
28-
uses: actions/create-github-app-token@v1
30+
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
2931
with:
30-
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
31-
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
32-
repositories: datadog-api-spec
32+
scope: DataDog/datadog-api-spec
33+
policy: datadog-api-client-python.approved_status.post-review-status
3334
- name: Post PR review status check
3435
uses: DataDog/github-actions/post-review-status@v2
3536
with:

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ jobs:
2020
name: Create release
2121
runs-on: ubuntu-latest
2222
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')
23+
permissions:
24+
id-token: write
2325
steps:
2426
- name: Get GitHub App token
2527
id: get_token
26-
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 #v1.11.1
28+
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
2729
with:
28-
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
29-
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
30+
scope: DataDog/datadog-api-client-python
31+
policy: self.github.release.master
3032

3133
- name: Checkout ${{ github.event.pull_request.base.ref }}
3234
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/reusable-ci.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ on:
2424
type: string
2525
default: '[{"platform": "macos-latest", "python-version": "3.8"}, {"platform": "ubuntu-latest", "python-version": "3.8"}, {"platform": "ubuntu-22.04", "python-version": "3.12"}]'
2626
secrets:
27-
PIPELINE_GITHUB_APP_ID:
28-
required: false
29-
PIPELINE_GITHUB_APP_PRIVATE_KEY:
30-
required: false
3127
# Integration test secrets
3228
DD_API_KEY:
3329
required: false
@@ -44,9 +40,6 @@ jobs:
4440
with:
4541
target-branch: ${{ inputs.target-branch }}
4642
enable-commit-changes: false # Don't auto-commit in external CI
47-
secrets:
48-
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
49-
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
5043

5144
test:
5245
uses: ./.github/workflows/reusable-python-test.yml
@@ -55,9 +48,6 @@ jobs:
5548
python-versions: ${{ inputs.python-versions }}
5649
platforms: ${{ inputs.platforms }}
5750
matrix-exclude: ${{ inputs.matrix-exclude }}
58-
secrets:
59-
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
60-
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
6151

6252
examples:
6353
uses: ./.github/workflows/reusable-examples.yml
@@ -70,10 +60,7 @@ jobs:
7060
target-branch: ${{ inputs.target-branch }}
7161
has-integration-label: ${{ contains(github.event.pull_request.labels.*.name, 'ci/integrations') }}
7262
secrets:
73-
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
74-
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
7563
DD_API_KEY: ${{ secrets.DD_API_KEY }}
7664
DD_CLIENT_API_KEY: ${{ secrets.DD_CLIENT_API_KEY }}
7765
DD_CLIENT_APP_KEY: ${{ secrets.DD_CLIENT_APP_KEY }}
7866
SLEEP_AFTER_REQUEST: ${{ secrets.SLEEP_AFTER_REQUEST }}
79-

.github/workflows/reusable-integration-test.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ on:
4444
type: boolean
4545
default: false
4646
secrets:
47-
PIPELINE_GITHUB_APP_ID:
48-
required: false
49-
PIPELINE_GITHUB_APP_PRIVATE_KEY:
50-
required: false
5147
DD_API_KEY:
5248
required: true
5349
DD_CLIENT_API_KEY:
@@ -81,15 +77,17 @@ jobs:
8177
DD_API_KEY: ${{ secrets.DD_API_KEY }}
8278
DD_HOSTNAME: "none"
8379
DD_INSIDE_CI: "true"
80+
permissions:
81+
id-token: write
82+
contents: read
8483
steps:
8584
- name: Get GitHub App token
8685
if: github.event_name == 'pull_request'
8786
id: get_token
88-
uses: actions/create-github-app-token@v1
87+
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
8988
with:
90-
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
91-
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
92-
repositories: ${{ inputs.target-repo || 'datadog-api-spec' }}
89+
scope: DataDog/datadog-api-spec
90+
policy: datadog-api-client-python.reusable-integration-test.post-status
9391
- name: Checkout code
9492
uses: actions/checkout@v3
9593
with:

0 commit comments

Comments
 (0)