Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Trust policy for pre-commit fixes on pull requests
# Allows pushing pre-commit fixes back to PR branches
# Will be called in reusable-pre-commit.yml
issuer: https://token.actions.githubusercontent.com
subject: repo:DataDog/datadog-api-client-ruby:pull_request

claim_pattern:
event_name: pull_request
job_workflow_ref: DataDog/datadog-api-client-ruby/\.github/workflows/reusable-pre-commit\.yml@refs/pull/[0-9]+/merge
ref: refs/pull/[0-9]+/merge
repository: DataDog/datadog-api-client-ruby

permissions:
contents: write # Required for pushing pre-commit fixes
14 changes: 14 additions & 0 deletions .github/chainguard/self.github.release.master.sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Trust policy for creating releases on master branch
# Restricted to master branch (protected ref) for security
# Will be called in release.yml
issuer: https://token.actions.githubusercontent.com
subject: repo:DataDog/datadog-api-client-ruby:pull_request

claim_pattern:
event_name: pull_request
job_workflow_ref: DataDog/datadog-api-client-ruby/\.github/workflows/release\.yml@refs/heads/master
repository: DataDog/datadog-api-client-ruby
ref: refs/heads/master

permissions:
contents: write
9 changes: 5 additions & 4 deletions .github/workflows/approved_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/') &&
contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')
permissions:
id-token: write
steps:
- name: Get GitHub App token
id: get_token
uses: actions/create-github-app-token@v1
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: datadog-api-spec
scope: DataDog/datadog-api-spec
policy: datadog-api-client-ruby.approved_status.post-review-status
- name: Post PR review status check
uses: DataDog/github-actions/post-review-status@v2
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ jobs:
name: Create release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')
permissions:
id-token: write
steps:
- name: Get GitHub App token
id: get_token
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 #v1.11.1
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
scope: DataDog/datadog-api-client-ruby
policy: self.github.release.master

- name: Checkout ${{ github.event.pull_request.base.ref }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
default: ''

secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
# Integration test secrets
DD_API_KEY:
required: false
Expand All @@ -35,18 +31,13 @@ jobs:
with:
target-branch: ${{ inputs.target-branch }}
enable-commit-changes: false # Don't auto-commit in external CI
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

test:
uses: ./.github/workflows/reusable-ruby-test.yml
with:
target-branch: ${{ inputs.target-branch }}
cache-version: ${{ inputs.cache-version }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}

examples:
Expand All @@ -62,10 +53,7 @@ jobs:
cache-version: ${{ inputs.cache-version }}
has-integration-label: ${{ contains(github.event.pull_request.labels.*.name, 'ci/integrations') }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_CLIENT_API_KEY: ${{ secrets.DD_CLIENT_API_KEY }}
DD_CLIENT_APP_KEY: ${{ secrets.DD_CLIENT_APP_KEY }}
SLEEP_AFTER_REQUEST: ${{ secrets.SLEEP_AFTER_REQUEST }}

14 changes: 6 additions & 8 deletions .github/workflows/reusable-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ on:
type: boolean
default: false
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
DD_API_KEY:
required: true
DD_CLIENT_API_KEY:
Expand Down Expand Up @@ -86,15 +82,17 @@ jobs:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_HOSTNAME: "none"
DD_INSIDE_CI: "true"
permissions:
id-token: write
contents: read
steps:
- name: Get GitHub App token
if: github.event_name == 'pull_request'
id: get_token
uses: actions/create-github-app-token@v1
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: ${{ inputs.target-repo || 'datadog-api-spec' }}
scope: DataDog/datadog-api-spec
policy: datadog-api-client-ruby.reusable-integration-test.post-status
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/reusable-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ on:
required: false
type: boolean
default: true
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false

env:
GIT_AUTHOR_EMAIL: "packages@datadoghq.com"
Expand All @@ -26,14 +21,17 @@ env:
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Get GitHub App token
id: get_token
if: inputs.enable-commit-changes
uses: actions/create-github-app-token@v1
if: inputs.enable-commit-changes && github.event_name == 'pull_request'
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
scope: DataDog/datadog-api-client-ruby
policy: self.github.pre-commit.pull-requests
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/reusable-ruby-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ on:
type: string
default: ''
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
DD_API_KEY:
required: false

Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
github.event_name == 'schedule'
permissions:
id-token: write
contents: read
uses: ./.github/workflows/reusable-pre-commit.yml
with:
enable-commit-changes: true
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

test:
if: >
Expand All @@ -45,8 +45,6 @@ jobs:
test-script: './run-tests.sh'
cache-version: ${{ vars.CACHE_VERSION }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}

examples:
Expand All @@ -66,15 +64,16 @@ jobs:
needs:
- test
- examples
permissions:
id-token: write
steps:
- name: Get GitHub App token
if: github.event_name == 'pull_request'
id: get_token
uses: actions/create-github-app-token@v1
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: datadog-api-spec
scope: DataDog/datadog-api-spec
policy: datadog-api-client-ruby.test.post-status
- name: Post status check
uses: DataDog/github-actions/post-status-check@v2
with:
Expand Down
Loading