Skip to content
Draft
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
17 changes: 17 additions & 0 deletions .github/workflows/platform-collect-code-references.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Collect code references

on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch:
pull_request: # DROPME

jobs:
collect-code-references:
uses: Flagsmith/ci/.github/workflows/collect-code-references.yml@feat/github-code-references-reusable-workflow
with:
flagsmith_project_id: 12
flagsmith_admin_api_url: https://api.flagsmith.com
exclude_patterns: node_modules,venv,.git,cache,build,htmlcov,docs,.json,tests
secrets:
flagsmith_admin_api_key: ${{ secrets.FLAGSMITH_CODE_REFERENCES_API_KEY }}
Comment on lines +11 to +17

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 2 days ago

In general, the fix is to add an explicit permissions block that scopes the GITHUB_TOKEN to the minimum required privileges. Since this job appears to only need to read the repository contents to collect code references, we can safely set contents: read. This block can be set at the workflow root (applies to all jobs) or on the specific job. The simplest, least invasive change is to add a root-level permissions block under name: and before on:.

Concretely, in .github/workflows/platform-collect-code-references.yml, add:

permissions:
  contents: read

at the top-level, between the existing name: and on: keys. This does not change existing behavior other than potentially reducing permissions if the default was broader, and it resolves the CodeQL alert by explicitly constraining GITHUB_TOKEN. No imports or additional definitions are needed.

Suggested changeset 1
.github/workflows/platform-collect-code-references.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/platform-collect-code-references.yml b/.github/workflows/platform-collect-code-references.yml
--- a/.github/workflows/platform-collect-code-references.yml
+++ b/.github/workflows/platform-collect-code-references.yml
@@ -1,4 +1,6 @@
 name: Collect code references
+permissions:
+  contents: read
 
 on:
   schedule:
EOF
@@ -1,4 +1,6 @@
name: Collect code references
permissions:
contents: read

on:
schedule:
Copilot is powered by AI and may make mistakes. Always verify output.
153 changes: 0 additions & 153 deletions .github/workflows/poc-github-code-references.yml

This file was deleted.

Loading