Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/prefill-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Prefill PR Body

on:
pull_request:

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.

P1

Because this public repository uses the pull_request event, workflows opened from forks receive a read-only GITHUB_TOKEN; the requested write permission cannot elevate it, and pulls.update will fail with 403 for external contributions. Use pull_request_target (without checking out or executing contributor-controlled code) or another privileged follow-up workflow if fork PRs must also be updated.

🤖 Helpful? 👍/👎

types: [opened]

permissions:
pull-requests: write

jobs:
update-pr:
runs-on: ubuntu-latest

steps:
- name: Update PR body
uses: actions/github-script@v7
with:
script: |
const MARKER = "<!--Auto generated, don't edit-->";

const currentBody = context.payload.pull_request.body || "";
if (currentBody.includes(MARKER)) return;

const branch = encodeURIComponent(context.payload.pull_request.head.ref);
const yamatoUrl = "https://yamato.ds.unity3d.com/project/277/branch/" + branch + "/recent-jobs";

const yamatoBadge = "[![Yamato CI](https://img.shields.io/badge/Yamato-CI-blue?logo=unity&logoColor=white)](" + yamatoUrl + ")";

const buttons = MARKER + "\n" + yamatoBadge + "\n" + MARKER;

await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
body: `${buttons}\n\n${currentBody}`
});
Loading