Skip to content

refactor frontend - pr911#155

Open
dahyehayley wants to merge 3 commits intomainfrom
frontend_refactor
Open

refactor frontend - pr911#155
dahyehayley wants to merge 3 commits intomainfrom
frontend_refactor

Conversation

@dahyehayley
Copy link

@dahyehayley dahyehayley changed the title cherrypick e8361909f8f6145ebe94e20750812ee7ef71b758 refactor frontend - pr911 Mar 19, 2026
Comment on lines +11 to +68
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
node-version: ["24.x"]
env:
PLUGIN_API: true
DJANGO_VITE_DEV_MODE: true

steps:
- uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install the project
run: uv sync --locked --dev

- name: Install frontend packages
run: npm --prefix coldfront/static install

- name: Check for lint violations
run: uv run ruff check

- name: Check formatting
run: uv run ruff format --check

- name: Check frontend with eslint and prettier
run: npm --prefix coldfront/static run check

- name: Compile and bundle frontend static assets
run: npm --prefix coldfront/static run build

- name: Check bundled frontend static assets have been commited
run: |
if [[ `git status --porcelain` ]]; then
echo "Error: pre-compiled bundled frontend static assets have not been committed"
git status
exit 1
else
echo "Bundled frontend static assets check passed."
fi

- name: Check licence with reuse
run: uv run reuse lint

- name: Run tests
run: uv run coldfront test

- name: Check for migrations
run: uv run coldfront makemigrations --check

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 1 day ago

To fix the problem, explicitly declare minimal permissions for this workflow so that the automatically provided GITHUB_TOKEN cannot perform unnecessary write operations. For a CI workflow that only checks out code and runs build/test/lint commands, contents: read (and optionally packages: read if private packages are ever used) is typically sufficient.

The best fix without changing existing functionality is to add a workflow-level permissions block near the top of .github/workflows/ci.yml. This will apply to all jobs (there is only build right now) that don’t override permissions. No steps in the shown job require write access to the repository or other resources, so we can safely set contents: read. If you know this workflow needs to read GitHub Packages, you could also include packages: read, but based solely on the snippet we will only add contents: read.

Concretely: in .github/workflows/ci.yml, after the name: CI line and before the on: block, insert:

permissions:
  contents: read

No imports or additional methods are required because this is purely a configuration change in the GitHub Actions workflow file.

Suggested changeset 1
.github/workflows/ci.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/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,5 +1,8 @@
 name: CI
 
+permissions:
+  contents: read
+
 on:
   workflow_dispatch:
   pull_request:
EOF
@@ -1,5 +1,8 @@
name: CI

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants