Skip to content

ci: Add explicit GITHUB_TOKEN permissions to workflows - #32

Open
khvn26 wants to merge 5 commits into
mainfrom
kimgustyr/eng-1245-flagsmith-sql-flag-engine-add-f99b
Open

khvn26 wants to merge 5 commits into
mainfrom
kimgustyr/eng-1245-flagsmith-sql-flag-engine-add-f99b

Conversation

@khvn26

@khvn26 khvn26 commented Dec 3, 2026

Copy link
Copy Markdown
Member

Adds workflow-level permissions: blocks so these workflows keep working once the org default GITHUB_TOKEN becomes read-only.

  • ci.yml: contents: read, pull-requests: write. 5monkeys/cobertura-action uses github.token to post the coverage comment on the PR. Every other step only needs read access.
  • publish.yml: contents: read. The build job only needs read access. The publish job keeps its own id-token: write / contents: write block, which overrides the workflow-level one.

Generated with [Linear](https://linear.app/flagsmith/agent-session/783be06c-9b3e-4052-b04e-84a5fb6a822a)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

File Coverage Missing
All files 100% ✅

Minimum allowed coverage is 100%

Generated by 🐒 cobertura-action against d2c92bc

@khvn26
khvn26 marked this pull request as ready for review December 3, 2026 14:51
@khvn26
khvn26 requested a review from a team as a code owner December 3, 2026 14:51
@khvn26
khvn26 requested review from emyller and removed request for a team December 3, 2026 14:51

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread .github/workflows/ci.yml Resolved
Tests run with a read-only token and enforce the 100% coverage gate themselves. A separate job that runs no PR code downloads coverage.xml and posts the cobertura comment and check run, and is skipped for fork PRs.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Confidence score: 3/5

  • When coverage is below 100%, .github/workflows/ci.yml exits before uploading the artifact, so the dependent coverage job is skipped and PRs lose both the missing-lines comment and coverage check. Keep the gate, but ensure the report is uploaded even on failure.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:31">
P2: A sub-100% result exits here before the artifact upload, and the dependent `coverage` job is then skipped, so PRs that miss the gate get no missing-lines comment or coverage check. Keep the gate, but make the report artifact available and allow the reporting job to run on this coverage failure.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread .github/workflows/ci.yml Outdated
- run: make test
- name: Check Coverage
uses: 5monkeys/cobertura-action@v14
run: uv run coverage report --fail-under=100 --show-missing

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: A sub-100% result exits here before the artifact upload, and the dependent coverage job is then skipped, so PRs that miss the gate get no missing-lines comment or coverage check. Keep the gate, but make the report artifact available and allow the reporting job to run on this coverage failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/ci.yml, line 31:

<comment>A sub-100% result exits here before the artifact upload, and the dependent `coverage` job is then skipped, so PRs that miss the gate get no missing-lines comment or coverage check. Keep the gate, but make the report artifact available and allow the reporting job to run on this coverage failure.</comment>

<file context>
@@ -30,7 +28,30 @@ jobs:
       - run: make test
       - name: Check Coverage
-        uses: 5monkeys/cobertura-action@v14
+        run: uv run coverage report --fail-under=100 --show-missing
+      - name: Upload coverage report
+        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
</file context>

Upload coverage.xml before the 100% gate and run the reporting job unless cancelled, so PRs that miss the gate still get the missing-lines comment and check.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 existing issue remains and no new issues found across 1 file (changes from recent commits).

Confidence score: 4/5

  • In .github/workflows/ci.yml, the coverage job can fail to download its report when an earlier CI failure skips make test. Only run the report job when the test job produced the artifact.

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Turn on auto-fix | Re-trigger cubic

… report

Drop the separate coverage report step: pass --cov-fail-under=100 to the CI test command (local subset runs are unaffected). The reporting job now skips cobertura when no coverage.xml was uploaded, e.g. when the test job failed before pytest.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Confidence score: 4/5

  • In .github/workflows/ci.yml, suppressing all artifact-download failures can silently skip the coverage comment and check after tests pass if the download fails transiently. Limit tolerated failures to the expected missing-artifact case.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:50">
P2: This suppresses every artifact-download failure, not only the expected missing artifact, so a transient failure after successful tests silently skips the coverage comment and check. Make the failure tolerable only when `needs.ci.result != 'success'`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread .github/workflows/ci.yml
- name: Download coverage report
id: download
# No report if the test job failed before running pytest; skip reporting then.
continue-on-error: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This suppresses every artifact-download failure, not only the expected missing artifact, so a transient failure after successful tests silently skips the coverage comment and check. Make the failure tolerable only when needs.ci.result != 'success'.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/ci.yml, line 50:

<comment>This suppresses every artifact-download failure, not only the expected missing artifact, so a transient failure after successful tests silently skips the coverage comment and check. Make the failure tolerable only when `needs.ci.result != 'success'`.</comment>

<file context>
@@ -47,11 +45,15 @@ jobs:
       - name: Download coverage report
+        id: download
+        # No report if the test job failed before running pytest; skip reporting then.
+        continue-on-error: true
         uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
         with:
</file context>
Suggested change
continue-on-error: true
continue-on-error: ${{ needs.ci.result != 'success' }}

This branch has not been deployed

No deployments
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.

1 participant