Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eca7dbb
Make TypeScript test workflow reusable
MintsInc Sep 5, 2025
89430a3
Improve oncall schedule endpoint documentation (#2745)
api-clients-generation-pipeline[bot] Sep 5, 2025
3efab1d
Update Get All Notification Rules API docs to include pagination, sor…
api-clients-generation-pipeline[bot] Sep 5, 2025
7a373a1
Add Incident Notification Template Public Docs (#2760)
api-clients-generation-pipeline[bot] Sep 8, 2025
e6eac70
Bump versions and add changelog entries. (#2770)
api-clients-generation-pipeline[bot] Sep 9, 2025
86d17c6
Promote unstable aws v2 APIs and deprecate v1 (#2767)
api-clients-generation-pipeline[bot] Sep 9, 2025
e5fd4c2
Security Monitoring - Make hasOptionalGroupByFields updatable (#2639)
api-clients-generation-pipeline[bot] Sep 10, 2025
ab38186
Add Incident Notification Rules Public Spec (#2772)
api-clients-generation-pipeline[bot] Sep 10, 2025
399cb08
Update v1 and v2 GCP API specs to support `monitored_resource_configs…
api-clients-generation-pipeline[bot] Sep 10, 2025
7da53cb
Add action datastore API (#2731)
api-clients-generation-pipeline[bot] Sep 11, 2025
467017e
SDCD-1727: removing 1 hour time restriction for `finished_at` (#2774)
api-clients-generation-pipeline[bot] Sep 11, 2025
9f004b1
Allow to send batches of events in pipelines API (#2737)
api-clients-generation-pipeline[bot] Sep 12, 2025
61b0a7b
CI disallow documenting OPEN routes (#2743)
api-clients-generation-pipeline[bot] Sep 12, 2025
0b2e3b0
[SIEM] Include ruleId in SecurityMonitoringRuleConvertResponse (#2782)
api-clients-generation-pipeline[bot] Sep 12, 2025
ace0896
Add Query Parameters to ListOrgConnections Endpoint (#2784)
api-clients-generation-pipeline[bot] Sep 15, 2025
f6a14ca
Bump versions and add changelog entries. (#2792)
api-clients-generation-pipeline[bot] Sep 15, 2025
3465b80
run poetry update (#2793)
MintsInc Sep 15, 2025
bf9ac8f
Make TypeScript test workflow reusable
MintsInc Sep 5, 2025
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
162 changes: 162 additions & 0 deletions .github/workflows/reusable-typescript-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Reusable TypeScript Testing Workflow

on:
workflow_call:
inputs:
node-versions:
description: 'JSON array of Node.js versions to test against'
required: false
type: string
default: '["16", "18"]'
platforms:
description: 'JSON array of platforms to run tests on'
required: false
type: string
default: '["ubuntu-latest"]'
test-script:
description: 'Test script to execute'
required: false
type: string
default: './run-tests.sh'
examples-script:
description: 'Examples script to execute'
required: false
type: string
default: './check-examples.sh'
enable-status-reporting:
description: 'Whether to post status checks to datadog-api-spec repo'
required: false
type: boolean
default: false
status-context:
description: 'Context for status checks'
required: false
type: string
default: 'master/unit'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false

jobs:
pre-commit:
runs-on: ubuntu-latest
if: >
(github.event.pull_request.draft == false &&
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
github.event_name == 'schedule'
steps:
# Run only in this repository
- name: Get GitHub App token
id: get_token
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name == github.repository
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ steps.get_token.outputs.token }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
# Fetch a fork of the repo
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name != github.repository
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install pre-commit
run: python -m pip install pre-commit
- name: set PY
run: echo "PY=$(python -c 'import hashlib, sys, platform;print(hashlib.sha256(platform.python_version().encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- id: pre_commit
name: Run pre-commit
if: github.event.action != 'closed' && github.event.pull_request.merged != true
run: |
pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure --color=always
env:
FROM_REF: ${{ github.event.pull_request.base.sha }}
TO_REF: ${{ github.event.pull_request.head.sha }}
- name: Commit changes
if: github.event.pull_request.head.repo.full_name == github.repository && failure()
run: |-
git add -A
git config user.name "${GIT_AUTHOR_NAME}"
git config user.email "${GIT_AUTHOR_EMAIL}"
git commit -m "pre-commit fixes"
git push origin "HEAD:${HEAD_REF}"
exit 1
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_AUTHOR_NAME: "ci.datadog-api-spec"
- id: pre_commit_schedule
name: Run pre-commit in schedule
if: github.event_name == 'schedule'
run: |
pre-commit run --all-files --show-diff-on-failure --color=always

test:
strategy:
matrix:
node-version: ${{ fromJSON(inputs.node-versions) }}
platform: ${{ fromJSON(inputs.platforms) }}
runs-on: ${{ matrix.platform }}
if: (github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Test
run: ${{ inputs.test-script }}
shell: bash

examples:
runs-on: ubuntu-latest
if: (github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Check examples
run: ${{ inputs.examples-script }}
shell: bash

report:
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') && inputs.enable-status-reporting
needs:
- test
- examples
steps:
- name: Get GitHub App token
if: github.event_name == 'pull_request'
id: get_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: datadog-api-spec
- name: Post status check
uses: DataDog/github-actions/post-status-check@v2
with:
github-token: ${{ steps.get_token.outputs.token }}
repo: datadog-api-spec
status: ${{ (needs.test.result == 'cancelled' || needs.examples.result == 'cancelled') && 'pending' || needs.test.result == 'success' && needs.examples.result == 'success' && 'success' || 'failure' }}
context: ${{ inputs.status-context }}
125 changes: 12 additions & 113 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,121 +19,20 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
typescript-test:
uses: ./.github/workflows/reusable-typescript-test.yml
if: >
(github.event.pull_request.draft == false &&
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
github.event_name == 'schedule'
steps:
# Run only in this repository
- name: Get GitHub App token
id: get_token
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name == github.repository
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ steps.get_token.outputs.token }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
# Fetch a fork of the repo
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name != github.repository
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install pre-commit
run: python -m pip install pre-commit
- name: set PY
run: echo "PY=$(python -c 'import hashlib, sys, platform;print(hashlib.sha256(platform.python_version().encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- id: pre_commit
name: Run pre-commit
if: github.event.action != 'closed' && github.event.pull_request.merged != true
run: |
pre-commit run --from-ref "${FROM_REF}" --to-ref "${TO_REF}" --show-diff-on-failure --color=always
env:
FROM_REF: ${{ github.event.pull_request.base.sha }}
TO_REF: ${{ github.event.pull_request.head.sha }}
- name: Commit changes
if: github.event.pull_request.head.repo.full_name == github.repository && failure()
run: |-
git add -A
git config user.name "${GIT_AUTHOR_NAME}"
git config user.email "${GIT_AUTHOR_EMAIL}"
git commit -m "pre-commit fixes"
git push origin "HEAD:${HEAD_REF}"
exit 1
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
- id: pre_commit_schedule
name: Run pre-commit in schedule
if: github.event_name == 'schedule'
run: |
pre-commit run --all-files --show-diff-on-failure --color=always

test:
strategy:
matrix:
node-version: ["16", "18"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
if: (github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Test
run: ./run-tests.sh
shell: bash

examples:
runs-on: ubuntu-latest
if: (github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Check examples
run: ./check-examples.sh
shell: bash

report:
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')
needs:
- test
- examples
steps:
- name: Get GitHub App token
if: github.event_name == 'pull_request'
id: get_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: datadog-api-spec
- name: Post status check
uses: DataDog/github-actions/post-status-check@v2
with:
github-token: ${{ steps.get_token.outputs.token }}
repo: datadog-api-spec
status: ${{ (needs.test.result == 'cancelled' || needs.examples.result == 'cancelled') && 'pending' || needs.test.result == 'success' && needs.examples.result == 'success' && 'success' || 'failure' }}
context: master/unit
with:
node-versions: '["16", "18"]'
platforms: '["ubuntu-latest"]'
test-script: './run-tests.sh'
examples-script: './check-examples.sh'
enable-status-reporting: ${{ contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') }}
status-context: 'master/unit'
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
Loading