[PR #6817] [CLOSED] Handle fork PRs gracefully in release notes generation #48577

Closed
opened 2026-04-26 10:29:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6817
Author: @StephenBrown2
Created: 1/29/2026
Status: Closed

Base: masterHead: handle-fork-prs


📝 Commits (1)

  • 071ff6b [AI] Fix AI-generated release notes workflow for fork PRs

📊 Changes

3 files changed (+30 additions, -7 deletions)

View changed files

📝 .github/actions/ai-generated-release-notes/create-release-notes-file.js (+22 -6)
📝 .github/workflows/ai-generated-release-notes.yml (+2 -1)
upcoming-release-notes/6817.md (+6 -0)

📄 Description

Summary

This PR fixes the AI-generated release notes workflow so it can create and commit the release-notes file on fork PR branches. The workflow was unable to write to fork branches; this change fixes the permission context by passing both tokens and choosing the correct one in the script.

What changed

  • Workflow (.github/workflows/ai-generated-release-notes.yml): The step that creates/commits the release notes file now receives both GITHUB_TOKEN and ACTIONS_UPDATE_TOKEN (previously only ACTIONS_UPDATE_TOKEN was passed).
  • Script (.github/actions/ai-generated-release-notes/create-release-notes-file.js): Uses GITHUB_TOKEN for reading PR details. For writing the file via the Contents API, it chooses the token by repo:
    • PR from fork (head repo ≠ current repo): use ACTIONS_UPDATE_TOKEN so the workflow (running in the base repo) can write to the fork.
    • Same-repo PR: use GITHUB_TOKEN.
      If the script needs to write to a different repo and ACTIONS_UPDATE_TOKEN is not set, it exits with a clear error (e.g. when the workflow runs in a contributor’s fork and they don’t have the PAT).

Permissions and context

  • For a fork PR (e.g. contributor/actualactualbudget/actual), the issue_comment event runs in the base repo, so the job has access to ACTIONS_UPDATE_TOKEN and can write to the fork’s branch via the chosen token.
  • For a same-repo branch PR, the write targets the current repo, so GITHUB_TOKEN is used.
  • If the workflow runs inside a fork (e.g. a PR within the fork), the fork has no ACTIONS_UPDATE_TOKEN; same-repo writes still work via GITHUB_TOKEN.

Comparison to VRT Update workflows

The VRT Update flow is split into two workflows:

  1. VRT Update - Generate (triggered by issue_comment): generates a patch and uploads it as an artifact.
  2. VRT Update - Apply (triggered by workflow_run when Generate completes): runs in the base repo, so it always has ACTIONS_UPDATE_TOKEN and can push to the fork.

That split guarantees the write step runs in the base repo. For release notes we kept a single workflow and fixed token selection. If fork PRs still cannot create files (e.g. if GitHub restricts secrets for this trigger), the next step would be to split into Generate + Apply via workflow_run like VRT so the commit step always runs in the base repo.

Test plan

  • Run workflow on a fork PR and confirm the release-notes file is created on the PR branch when CodeRabbit’s first comment is posted and the PR targets master.
  • Confirm same-repo PRs still get the file (using GITHUB_TOKEN).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6817 **Author:** [@StephenBrown2](https://github.com/StephenBrown2) **Created:** 1/29/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `handle-fork-prs` --- ### 📝 Commits (1) - [`071ff6b`](https://github.com/actualbudget/actual/commit/071ff6b91d9c1b44f7583faf008d7a2cb5225aea) [AI] Fix AI-generated release notes workflow for fork PRs ### 📊 Changes **3 files changed** (+30 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/ai-generated-release-notes/create-release-notes-file.js` (+22 -6) 📝 `.github/workflows/ai-generated-release-notes.yml` (+2 -1) ➕ `upcoming-release-notes/6817.md` (+6 -0) </details> ### 📄 Description ## Summary This PR fixes the AI-generated release notes workflow so it can create and commit the release-notes file on fork PR branches. The workflow was unable to write to fork branches; this change fixes the permission context by passing both tokens and choosing the correct one in the script. ## What changed - **Workflow** (`.github/workflows/ai-generated-release-notes.yml`): The step that creates/commits the release notes file now receives both `GITHUB_TOKEN` and `ACTIONS_UPDATE_TOKEN` (previously only `ACTIONS_UPDATE_TOKEN` was passed). - **Script** (`.github/actions/ai-generated-release-notes/create-release-notes-file.js`): Uses `GITHUB_TOKEN` for reading PR details. For writing the file via the Contents API, it chooses the token by repo: - **PR from fork** (head repo ≠ current repo): use `ACTIONS_UPDATE_TOKEN` so the workflow (running in the base repo) can write to the fork. - **Same-repo PR**: use `GITHUB_TOKEN`. If the script needs to write to a different repo and `ACTIONS_UPDATE_TOKEN` is not set, it exits with a clear error (e.g. when the workflow runs in a contributor’s fork and they don’t have the PAT). ## Permissions and context - For a **fork PR** (e.g. `contributor/actual` → `actualbudget/actual`), the `issue_comment` event runs in the **base** repo, so the job has access to `ACTIONS_UPDATE_TOKEN` and can write to the fork’s branch via the chosen token. - For a **same-repo** branch PR, the write targets the current repo, so `GITHUB_TOKEN` is used. - If the workflow runs **inside a fork** (e.g. a PR within the fork), the fork has no `ACTIONS_UPDATE_TOKEN`; same-repo writes still work via `GITHUB_TOKEN`. ## Comparison to VRT Update workflows The **VRT Update** flow is split into two workflows: 1. **VRT Update - Generate** (triggered by `issue_comment`): generates a patch and uploads it as an artifact. 2. **VRT Update - Apply** (triggered by `workflow_run` when Generate completes): runs in the **base** repo, so it always has `ACTIONS_UPDATE_TOKEN` and can push to the fork. That split guarantees the write step runs in the base repo. For release notes we kept a **single workflow** and fixed token selection. If fork PRs still cannot create files (e.g. if GitHub restricts secrets for this trigger), the next step would be to split into Generate + Apply via `workflow_run` like VRT so the commit step always runs in the base repo. ## Test plan - Run workflow on a fork PR and confirm the release-notes file is created on the PR branch when CodeRabbit’s first comment is posted and the PR targets `master`. - Confirm same-repo PRs still get the file (using `GITHUB_TOKEN`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-26 10:29:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#48577