ADR ↔ Discussions workflow
Philosophy
Ideas are discussed in GitHub Discussions (category Ideas). When a conversation matures and the team wants to formalize the decision, any member with write access comments /adr on the thread and a workflow:
- Creates a PR with an ADR stub (frontmatter + empty sections).
- The stub includes
discussion: <number>pointing to the original thread. - Posts a link to the PR in the Discussion.
The Discussion is not closed when the PR is merged: it remains as a permanent thread for amendments, clarifications, and revisiting the decision later.
There is no separate Decisions category. For a small team, creating another conversation channel would be unnecessary ceremony.
Flow
Ideas (Discussions)
│
▼ open conversation, days or weeks
│
someone comments:
/adr
│
▼
.github/workflows/adr-from-discussion.yml
1. Guard: /adr + category=ideas + write access
2. Checkout main
3. Next ADR number = max(files in docs/adrs/) + 1
4. Create branch adr/NNNN-<slug-from-title>
5. Write docs/adrs/NNNN-<slug>.md with:
- frontmatter (title, status:Proposed, date, discussion:<num>)
- empty sections + :::info bootstrap note
6. gh pr create
7. React to /adr with a rocket reaction
8. Comment on the Discussion with the PR link
│
▼
ADR author completes the content, opens review
│
▼
PR merge → ADR published
(Discussion stays open as a permanent channel)
How to use it
Scenario 1: ADR originates from a discussion
- Open a Discussion in the
Ideascategory, with the title matching the future ADR title. - Discuss freely (no ceremony).
- When there is consensus, someone simply comments:
/adr
- Within ~30 seconds the bot opens a PR and comments with the link.
- Edit the PR, complete the sections, request review, merge.
Scenario 2: ADR without a prior Discussion
Some decisions are obvious and do not warrant a thread. Open the PR directly by copying docs/adrs/template.md. The card renders No discussion linked in the Discussion row — this is informational and does not block anything.
Triple guard on the workflow (zero cost when it does not match)
if: |
startsWith(github.event.comment.body, '/adr') &&
github.event.discussion.category.slug == 'ideas' &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'),
github.event.comment.author_association)
- Regular comments: the workflow run is marked as Skipped, no runner is assigned, zero minutes consumed.
/adroutside theIdeascategory: skipped./adrfrom someone without write access: skipped (prevents abuse by outside contributors).
Setup (one-time)
These steps require admin access and the web UI:
- Enable Discussions on the repo:
Settings → General → Features → Discussions. Already enabled. Ideascategory: included by default when you enable Discussions. Already exists.- Workflow permissions: the workflow explicitly declares
contents: write,discussions: write,pull-requests: write. No need to change the default.
Token permissions
The action uses the default GITHUB_TOKEN with:
contents: write— create branch, commit, pushdiscussions: write— comment and react on the Discussionpull-requests: write— open PR
If/when switching to the GitHub App eigenoid-release-bot, the scopes are identical — just swap the token env var.
Troubleshooting
- I commented
/adrand nothing happened- Is the Discussion in the
Ideascategory? (other categories do not trigger the workflow) - Do you have write access to the repo? (outside contributors are filtered out)
- Check the Actions tab: look for the "ADR from Discussion" run. If it shows as Skipped, the guard rejected it. If it shows as Failed, check the logs.
- Is the Discussion in the
- PR was created but the Discussion does not show the comment
- Could be a race condition or API delay. Refresh after 30 seconds. If it persists, check the logs.
- "File already exists"
- Two
/adrcommands fired simultaneously on different threads and collided. One succeeds, the other fails. Comment/adragain and it will take the next available number.
- Two
- Original Discussion linked to a merged ADR is left orphaned
- By design. We leave it open permanently as a channel for post-Accepted follow-ups.
Related
- ADR template:
docs/adrs/template.md - Workflow:
.github/workflows/adr-from-discussion.yml - Script:
.github/scripts/bootstrap-adr-from-discussion.mjs