Skip to content
Open
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
15 changes: 0 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,6 @@ jobs:
# GitHub Pages directory path
ghpagesdir: ./docs

Formatting:
name: Clang Format
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'src'
- 'examples'
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '14'
check-path: ${{ matrix.path }}

Linting:
name: Shellcheck
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/formatting-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: clang-format Check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'src'
- 'examples'
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.15.0
with:
clang-format-version: '14'
check-path: ${{ matrix.path }}
Comment on lines +5 to +18

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 5 months ago

To fix the issue, add a permissions block to the workflow file. Since the workflow only performs a formatting check and does not require write access, the permissions can be limited to contents: read. This ensures that the GITHUB_TOKEN adheres to the principle of least privilege.

The permissions block should be added at the root level of the workflow file, as this will apply to all jobs in the workflow unless overridden by job-specific permissions.


Suggested changeset 1
.github/workflows/formatting-check.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/formatting-check.yml b/.github/workflows/formatting-check.yml
--- a/.github/workflows/formatting-check.yml
+++ b/.github/workflows/formatting-check.yml
@@ -2,2 +2,4 @@
 on: [push, pull_request]
+permissions:
+  contents: read
 jobs:
EOF
@@ -2,2 +2,4 @@
on: [push, pull_request]
permissions:
contents: read
jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading