Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
27 changes: 27 additions & 0 deletions .github/workflows/native-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Cable Modem Agent Component in Native Environment

on:
push:
branches: [ main, 'sprint/**', 'release/**', 'feature/**', develop ]
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch pattern inconsistency: The 'topic/RDK*' pattern is included in pull_request triggers (line 7) but not in push triggers (line 5). If topic/RDK* branches should trigger builds, consider adding this pattern to the push branches list for consistency. If this is intentional (e.g., topic branches should only build on PRs), this is acceptable.

Suggested change
branches: [ main, 'sprint/**', 'release/**', 'feature/**', develop ]
branches: [ main, 'sprint/**', 'release/**', 'feature/**', topic/RDK*, develop ]

Copilot uses AI. Check for mistakes.
pull_request:
branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ]

Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow does not declare permissions, unlike the fossid workflow which explicitly declares "contents: read" and "pull-requests: read" permissions. Following security best practices and the pattern established in other workflows in this repository, add explicit permissions to follow the principle of least privilege.

Suggested change
permissions:
contents: read
pull-requests: read

Copilot uses AI. Check for mistakes.
jobs:
build-cable-modem-agent-on-pr:
name: Build Cable Modem Agent component in github rdkcentral
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow does not include fork protection (if: ${{ ! github.event.pull_request.head.repo.fork }}) that is present in the fossid workflow (line 13 of fossid_integration_stateless_diffscan_target_repo.yml). Since this workflow uses the RDKCM_RDKE secret to access potentially private repositories, it should not run for PRs from forks where secrets are not available. Add a condition to skip fork PRs to prevent workflow failures.

Suggested change
name: Build Cable Modem Agent component in github rdkcentral
name: Build Cable Modem Agent component in github rdkcentral
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using actions/checkout@v3 which may be outdated. Consider using actions/checkout@v4 for improved performance and features, unless there's a specific reason to use v3.

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@v4

Copilot uses AI. Check for mistakes.

- name: native build
run: |
chmod +x cov_docker_script/run_setup_dependencies.sh
./cov_docker_script/run_setup_dependencies.sh
chmod +x cov_docker_script/run_native_build.sh
./cov_docker_script/run_native_build.sh
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
Comment on lines +11 to +27

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: {contents: read}

Copilot Autofix

AI 14 days ago

In general, to fix this issue you should explicitly declare a permissions block either at the workflow root (applies to all jobs) or under the specific job, granting only the scopes actually needed (often just contents: read as a minimum). This constrains the automatic GITHUB_TOKEN created by GitHub Actions, even if your steps never reference it directly, and documents the minimal required permissions.

For this workflow, the simplest change that does not affect existing behavior is to add a minimal permissions block at the job level for build-cable-modem-agent-on-pr. The steps only check out the repository and run local scripts; there is no evidence they need write access to the repo or other resources via GITHUB_TOKEN. Therefore, adding:

permissions:
  contents: read

under the job definition (aligned with runs-on:) is sufficient and safest. No additional imports, methods, or definitions are required, since this is purely a YAML configuration change in .github/workflows/native-build.yml.

Suggested changeset 1
.github/workflows/native-build.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/native-build.yml b/.github/workflows/native-build.yml
--- a/.github/workflows/native-build.yml
+++ b/.github/workflows/native-build.yml
@@ -10,6 +10,8 @@
   build-cable-modem-agent-on-pr:
     name: Build Cable Modem Agent component in github rdkcentral
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     container:
       image: ghcr.io/rdkcentral/docker-rdk-ci:latest
 
EOF
@@ -10,6 +10,8 @@
build-cable-modem-agent-on-pr:
name: Build Cable Modem Agent component in github rdkcentral
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: ghcr.io/rdkcentral/docker-rdk-ci:latest

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +22 to +27
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable GITHUB_TOKEN is set to a secret named RDKCM_RDKE, but GITHUB_TOKEN is a reserved name used by GitHub Actions. If this is meant to be a custom token for accessing private repositories, it should use a different name (e.g., CUSTOM_GITHUB_TOKEN or ACCESS_TOKEN) to avoid confusion with the automatic GITHUB_TOKEN provided by Actions.

Suggested change
chmod +x cov_docker_script/run_setup_dependencies.sh
./cov_docker_script/run_setup_dependencies.sh
chmod +x cov_docker_script/run_native_build.sh
./cov_docker_script/run_native_build.sh
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
export GITHUB_TOKEN="$CUSTOM_GITHUB_TOKEN"
chmod +x cov_docker_script/run_setup_dependencies.sh
./cov_docker_script/run_setup_dependencies.sh
chmod +x cov_docker_script/run_native_build.sh
./cov_docker_script/run_native_build.sh
env:
CUSTOM_GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}

Copilot uses AI. Check for mistakes.
Loading
Loading