Skip to content

fix(lock-closed): grant discussions write permission#399

Merged
prisis merged 1 commit into
mainfrom
fix/lock-closed-discussions-permission
May 28, 2026
Merged

fix(lock-closed): grant discussions write permission#399
prisis merged 1 commit into
mainfrom
fix/lock-closed-discussions-permission

Conversation

@prisis
Copy link
Copy Markdown
Member

@prisis prisis commented May 28, 2026

Summary

The shared lock-closed.yml reusable workflow fails with Error: Resource not accessible by integration when dessant/lock-threads reaches its discussion-locking step.

Root cause: dessant/lock-threads@v6 defaults discussion-inactive-days: 365, so it always attempts to lock inactive discussions. Reusable workflows use their own top-level permissions: block (which overrides the permissions the caller passes down), and this workflow declared only issues: write + pull-requests: write. The discussions: write scope the callers grant (e.g. lock-issues.yaml) was therefore stripped, so the discussion API call was unauthorized.

Fix: add discussions: "write" to the reusable workflow's permissions: block, matching the intent already expressed by every caller.

Test plan

  • Re-run a consumer's "Lock inactive issues and pull requests" workflow (e.g. via @main consumers) and confirm it completes without the "Resource not accessible by integration" error.

Summary by CodeRabbit

  • Chores
    • Updated workflow permissions configuration to enable GitHub Discussions integration.

Review Change Stack

dessant/lock-threads locks inactive discussions by default
(discussion-inactive-days: 365). Reusable workflows use their own
permissions block (overriding what the caller passes down), and this one
omitted discussions: write, so the action failed with "Resource not
accessible by integration" when reaching the discussion-locking step.
Callers already grant discussions: write, confirming the intent.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 890f1171-b524-401b-8418-6a035241dd29

📥 Commits

Reviewing files that changed from the base of the PR and between 1dc687e and 8bb9c66.

📒 Files selected for processing (1)
  • .github/workflows/lock-closed.yml

📝 Walkthrough

Walkthrough

The lock-closed GitHub Actions workflow now includes write permission for GitHub Discussions. This single-line change grants the workflow the ability to lock or modify discussions, alongside its existing permissions for issues and pull requests.

Changes

Discussions Write Permission

Layer / File(s) Summary
Discussions write permission
.github/workflows/lock-closed.yml
Workflow permissions extended with discussions: "write" to enable the locking action to operate on discussion threads.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A single line, a gentle change,
Permissions granted in workflow's range,
Discussions now can be locked with care,
One small addition, clean and fair! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(lock-closed): grant discussions write permission' accurately and concisely describes the main change: adding write permission for discussions to the lock-closed workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lock-closed-discussions-permission

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.

@prisis prisis merged commit fb949a5 into main May 28, 2026
16 of 24 checks passed
@prisis prisis deleted the fix/lock-closed-discussions-permission branch May 28, 2026 09:07
prisis pushed a commit that referenced this pull request May 29, 2026
…2026-05-29)

### Bug Fixes

* **deps:** pin dessant/lock-threads to v6.0.2 ([9705d8f](9705d8f))
* **lint:** hide package.json from npm so actionlint works with pnpm catalog: refs ([1dc687e](1dc687e))
* **lock-closed:** grant discussions write permission ([#399](#399)) ([fb949a5](fb949a5))

### Miscellaneous Chores

* **deps:** apply pnpm audit fixes and dedupe ([dc2b7bc](dc2b7bc))
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