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
42 changes: 42 additions & 0 deletions .github/workflows/_report-to-ketryx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Ketryx report'

on:
workflow_call:
inputs:
build-name:
description: 'The build name to report'
required: true
type: string
secrets:
KETRYX_PROJECT:
description: 'Ketryx project ID'
required: true
KETRYX_API_KEY:
description: 'Ketryx API key'
required: true

jobs:
report-to-ketryx:
runs-on: ubuntu-latest
steps:
- name: Download SDK test results
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results-sdk
path: test-results/sdk/

- name: Download CLI test results
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: test-results-cli
path: test-results/cli/

- name: Report to Ketryx
uses: Ketryx/ketryx-github-action@v1.4.0
with:
project: ${{ secrets.KETRYX_PROJECT }}
api-key: ${{ secrets.KETRYX_API_KEY }}
build-name: ${{ inputs.build-name }}
test-junit-path: test-results/**/*.xml
Comment on lines +20 to +42

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 1 day ago

To fix the issue, explicitly set the permissions: key in the workflow, limiting GITHUB_TOKEN to the minimal privileges required. Since this workflow only downloads artifacts and calls an external action, it does not require any write access to the repository contents or metadata. The minimal required permission is likely contents: read. Insert permissions: contents: read at the top level of the workflow, below the name key but above on:, so that the permission applies to all jobs within the workflow. No other changes are required; do not grant broader access unless a particular step or action clearly requires it.

Suggested changeset 1
.github/workflows/_report-to-ketryx.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/_report-to-ketryx.yml b/.github/workflows/_report-to-ketryx.yml
--- a/.github/workflows/_report-to-ketryx.yml
+++ b/.github/workflows/_report-to-ketryx.yml
@@ -1,4 +1,6 @@
 name: 'Ketryx report'
+permissions:
+  contents: read
 
 on:
     workflow_call:
EOF
@@ -1,4 +1,6 @@
name: 'Ketryx report'
permissions:
contents: read

on:
workflow_call:
Copilot is powered by AI and may make mistakes. Always verify output.
26 changes: 25 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ jobs:
- name: Run tests with coverage
run: npx nx run-many -t test --coverage

- name: Upload SDK test results
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: test-results-sdk
path: packages/sdk/test-results/*.xml

- name: Upload CLI test results
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: test-results-cli
path: packages/cli/test-results/*.xml

- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -108,11 +122,21 @@ jobs:
publish_dir: ./docs
cname: aignostics-platform-sdk.github.io

run-ketryx-report:
needs: test
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/_report-to-ketryx.yml
with:
build-name: "pre-release"
secrets:
KETRYX_PROJECT: KXPRJ7F47PAK8VB9B4BB0G4AYCXCBSY # not a secret
KETRYX_API_KEY: ${{ secrets.KETRYX_API_KEY }}

release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [test, build-docs]
needs: [test, build-docs, run-ketryx-report]
if: github.ref == 'refs/heads/main'
environment:
name: production
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ build/
coverage/
*.lcov

# Test results
test-results/

# IDE
.vscode/
.idea/
Expand Down
Loading