Skip to content

chore: update opencode workflow permissions - #80

Merged
ssdeanx merged 1 commit into
mainfrom
develop
Jan 8, 2026
Merged

ssdeanx merged 1 commit into
mainfrom
develop

Conversation

@ssdeanx

@ssdeanx ssdeanx commented Jan 8, 2026 •

Copy link
Copy Markdown
Owner
  • Moved permissions section to the top level of the opencode workflow for clarity.
  • Removed redundant permissions declaration from the job level.

Summary by Sourcery

Simplify GitHub Actions workflows by centralizing permissions in the opencode workflow and removing an obsolete flaky test workflow.

CI:

  • Move the permissions configuration for the opencode workflow from the job level to the workflow level for clearer, centralized access control.
  • Remove the deprecated flaky.yml GitHub Actions workflow.

- Moved permissions section to the top level of the opencode workflow for clarity.
- Removed redundant permissions declaration from the job level.
Copilot AI review requested due to automatic review settings January 8, 2026 15:01
@continue

continue Bot commented Jan 8, 2026

Copy link
Copy Markdown

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@sourcery-ai

sourcery-ai Bot commented Jan 8, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts GitHub Actions workflow permissions for the opencode workflow by moving permissions to the workflow level and removes a redundant job-level declaration; also deletes the unused flaky.yml workflow.

Flow diagram for GitHub event triggers and opencode job execution

flowchart TB
  subgraph GitHub_Events["GitHub events"]
    direction TB
    Issue_Comment["issue_comment.created"]
    PR_Review_Comment["pull_request_review_comment.created"]
  end

  Issue_Comment --> Check_Body
  PR_Review_Comment --> Check_Body

  Check_Body["Check if comment body contains '/opencode' or ' /opencode'"] -->|true| Run_Opencode_Job
  Check_Body -->|false| No_Action["No job triggered"]

  subgraph Opencode_Workflow["opencode.yml"]
    direction TB
    Workflow_Permissions["Workflow-level permissions\n(id-token write, contents read, pull-requests read, issues read)"]
    Run_Opencode_Job["Run job opencode"]
  end

  Workflow_Permissions --> Run_Opencode_Job
Loading

File-Level Changes

Change Details Files
Move GitHub Actions permissions from job scope to workflow (top-level) scope for the opencode workflow.
  • Add a top-level permissions block defining id-token: write, contents: read, pull-requests: read, and issues: read for the workflow
  • Remove the equivalent permissions block from the opencode job to avoid redundancy and rely on the workflow-level permissions
.github/workflows/opencode.yml
Remove the flaky GitHub Actions workflow as it is no longer needed.
  • Delete the flaky.yml workflow file from the .github/workflows directory
.github/workflows/flaky.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown

🤖 Hi @ssdeanx, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@coderabbitai

coderabbitai Bot commented Jan 8, 2026 •

Copy link
Copy Markdown

Summary by CodeRabbit

  • Chores
    • Removed an unused continuous integration testing workflow
    • Updated permission scope in continuous integration workflow configuration

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Removed the flaky.yml GitHub Actions workflow entirely (29 lines deleted) and restructured permissions in opencode.yml by moving job-level permission declarations to a global workflow-level permissions block.

Changes

Cohort / File(s) Summary
CI Workflow Deletion
​.github/workflows/flaky.yml
Entire workflow file removed. Previously defined a test job with Trunk.io upload step that ran on push/PR to main/develop branches.
Permission Restructuring
​.github/workflows/opencode.yml
Top-level permissions block added with id-token: write, contents: read, pull-requests: read, issues: read. Removed job-level permissions block; conditional logic unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 The flaky workflow hops away,
While opencode permissions now hold sway—
Global scope replaces the old per-job way,
Workflows cleaner, simpler today! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating opencode workflow permissions by moving them to the top level.
Description check ✅ Passed The description is directly related to the changeset, explaining both the opencode workflow permission refactoring and the flaky.yml removal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e448a0b and 9981cba.

📒 Files selected for processing (2)
  • .github/workflows/flaky.yml
  • .github/workflows/opencode.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/flaky.yml
🧰 Additional context used
📓 Path-based instructions (1)
**/.github/workflows/*.{yml,yaml}

📄 CodeRabbit inference engine (.github/instructions/github-actions-ci-cd-best-practices.instructions.md)

**/.github/workflows/*.{yml,yaml}: Use consistent, descriptive names for workflow files (e.g., build-and-test.yml, deploy-prod.yml)
Define permissions at the workflow level for a secure default, overriding at the job level if needed, following the principle of least privilege
Always start with a descriptive name and appropriate on trigger. Suggest granular triggers for specific use cases (e.g., on: push: branches: [main] vs. on: pull_request)
Recommend using workflow_dispatch for manual triggers, allowing input parameters for flexibility and controlled deployments
Use concurrency to prevent simultaneous runs for specific branches or groups, avoiding race conditions or wasted resources
Define jobs with clear name and appropriate runs-on (e.g., ubuntu-latest, windows-latest, self-hosted)
Use needs to define dependencies between jobs, ensuring sequential execution and logical flow
Employ outputs to pass data between jobs efficiently, promoting modularity
Utilize if conditions for conditional job execution (e.g., deploy only on main branch pushes, run E2E tests only for certain PRs, skip jobs based on file changes)
Use uses to reference marketplace or custom actions, always specifying a secure version (tag or SHA), never pinning to main or latest
Use name for each step for readability in logs and easier debugging
Use run for shell commands, combining commands with && for efficiency and using | for multi-line scripts
Always instruct users to use GitHub Secrets for sensitive information (e.g., API keys, passwords, cloud credentials, tokens), accessed via secrets.<SECRET_NAME>
Recommend using environment-specific secrets for deployment environments to enforce stricter access controls and approvals
Strongly recommend OIDC for authenticating with AWS, Azure, GCP, and other cloud providers instead of storing long-lived access keys as secrets
Configure permissions at the workflow or job level to restrict GITHUB_TOKEN ...

Files:

  • .github/workflows/opencode.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Cleanup artifacts
  • GitHub Check: Sourcery review
  • GitHub Check: Codacy Security Scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.github/workflows/opencode.yml (1)

9-13: Permissions block is correctly configured; id-token: write is required.

The anomalyco/opencode action requires id-token: write permission to authenticate via OIDC and fetch JWT tokens, as documented in OpenCode's GitHub documentation. The permissions block is properly configured and should not be changed.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps greptile-apps 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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown

🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details.

@sourcery-ai sourcery-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.

Hey - I've found 1 issue, and left some high level feedback:

  • Removing .github/workflows/flaky.yml will completely disable the flaky test workflow; if that wasn’t intentional, consider keeping the workflow or replacing it with an updated equivalent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Removing `.github/workflows/flaky.yml` will completely disable the flaky test workflow; if that wasn’t intentional, consider keeping the workflow or replacing it with an updated equivalent.

## Individual Comments

### Comment 1
<location> `.github/workflows/opencode.yml:9-13` </location>
<code_context>
-      - main
-      - develop
-
-permissions:
-  contents: read
-
</code_context>

<issue_to_address>
**🚨 suggestion (security):** Consider keeping permissions scoped at the job level to avoid future over-broad grants.

At the workflow level, any future jobs will inherit `id-token: write`, `contents: read`, etc., even if they don't need them. To maintain least privilege and avoid unintentionally over-permissioning new jobs, it’s safer to keep these permissions defined only on the job that actually requires them unless you’re confident all jobs will share the same needs.

Suggested implementation:

```
jobs:

```

```
jobs:
  opencode:
    permissions:
      id-token: write
      contents: read
      pull-requests: read
      issues: read
    if: |
      contains(github.event.comment.body, ' /opencode') ||

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +9 to +13
permissions:
id-token: write
contents: read
pull-requests: read
issues: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 suggestion (security): Consider keeping permissions scoped at the job level to avoid future over-broad grants.

At the workflow level, any future jobs will inherit id-token: write, contents: read, etc., even if they don't need them. To maintain least privilege and avoid unintentionally over-permissioning new jobs, it’s safer to keep these permissions defined only on the job that actually requires them unless you’re confident all jobs will share the same needs.

Suggested implementation:

jobs:

jobs:
  opencode:
    permissions:
      id-token: write
      contents: read
      pull-requests: read
      issues: read
    if: |
      contains(github.event.comment.body, ' /opencode') ||

@opencode-agent

opencode-agent Bot commented Jan 8, 2026

Copy link
Copy Markdown

User sourcery-ai[bot] does not have write permissions

github run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the opencode.yml workflow by moving permissions from the job level to the workflow level for better clarity and maintainability. Additionally, the flaky.yml workflow file has been completely deleted.

Key Changes:

  • Moved permissions block to the top level of opencode.yml workflow (before the jobs section)
  • Removed the entire flaky.yml workflow file that handled test result uploads to Trunk.io

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/opencode.yml Refactored permissions from job-level to workflow-level, improving clarity without changing functionality
.github/workflows/flaky.yml Entire workflow file deleted (handles test analytics upload to Trunk.io)

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/opencode.yml (3)

16-22: Add timeout and concurrency controls for reliability.

Consider adding:

  1. timeout-minutes to prevent hung workflows from consuming resources indefinitely
  2. concurrency at the workflow level to prevent multiple simultaneous runs from rapid comment triggers
♻️ Suggested improvements

Add at the workflow level (after line 8):

concurrency:
  group: opencode-${{ github.event.issue.number || github.event.pull_request.number }}
  cancel-in-progress: true

Add to the job (after line 22):

    timeout-minutes: 30

24-25: Explicitly set fetch-depth: 1 for clarity.

While fetch-depth: 1 is the default, explicitly setting it improves clarity and ensures optimal performance.

♻️ Suggested improvement
       - name: Checkout repository
         uses: actions/checkout@v6
+        with:
+          fetch-depth: 1

27-28: Pin action to specific version instead of @latest.

Using @latest for the action version creates security and stability risks, as the action's code can change unexpectedly. Pinning to a specific version tag ensures predictable and secure workflow execution.

The latest available version is v1.1.6. Update the action reference as follows:

      - name: Run opencode
-       uses: anomalyco/opencode/github@latest
+       uses: anomalyco/opencode/github@v1.1.6
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e448a0b and 9981cba.

📒 Files selected for processing (2)
  • .github/workflows/flaky.yml
  • .github/workflows/opencode.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/flaky.yml
🧰 Additional context used
📓 Path-based instructions (1)
**/.github/workflows/*.{yml,yaml}

📄 CodeRabbit inference engine (.github/instructions/github-actions-ci-cd-best-practices.instructions.md)

**/.github/workflows/*.{yml,yaml}: Use consistent, descriptive names for workflow files (e.g., build-and-test.yml, deploy-prod.yml)
Define permissions at the workflow level for a secure default, overriding at the job level if needed, following the principle of least privilege
Always start with a descriptive name and appropriate on trigger. Suggest granular triggers for specific use cases (e.g., on: push: branches: [main] vs. on: pull_request)
Recommend using workflow_dispatch for manual triggers, allowing input parameters for flexibility and controlled deployments
Use concurrency to prevent simultaneous runs for specific branches or groups, avoiding race conditions or wasted resources
Define jobs with clear name and appropriate runs-on (e.g., ubuntu-latest, windows-latest, self-hosted)
Use needs to define dependencies between jobs, ensuring sequential execution and logical flow
Employ outputs to pass data between jobs efficiently, promoting modularity
Utilize if conditions for conditional job execution (e.g., deploy only on main branch pushes, run E2E tests only for certain PRs, skip jobs based on file changes)
Use uses to reference marketplace or custom actions, always specifying a secure version (tag or SHA), never pinning to main or latest
Use name for each step for readability in logs and easier debugging
Use run for shell commands, combining commands with && for efficiency and using | for multi-line scripts
Always instruct users to use GitHub Secrets for sensitive information (e.g., API keys, passwords, cloud credentials, tokens), accessed via secrets.<SECRET_NAME>
Recommend using environment-specific secrets for deployment environments to enforce stricter access controls and approvals
Strongly recommend OIDC for authenticating with AWS, Azure, GCP, and other cloud providers instead of storing long-lived access keys as secrets
Configure permissions at the workflow or job level to restrict GITHUB_TOKEN ...

Files:

  • .github/workflows/opencode.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Cleanup artifacts
  • GitHub Check: Sourcery review
  • GitHub Check: Codacy Security Scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
.github/workflows/opencode.yml (1)

9-13: Permissions block is correctly configured; id-token: write is required.

The anomalyco/opencode action requires id-token: write permission to authenticate via OIDC and fetch JWT tokens, as documented in OpenCode's GitHub documentation. The permissions block is properly configured and should not be changed.

@ssdeanx
ssdeanx merged commit 6a057ee into main Jan 8, 2026
46 of 51 checks passed
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