mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Some checks are pending
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Waiting to run
Publish to ghcr / merge (push) Blocked by required conditions
Update Roadmap Released / update (push) Waiting to run
79 lines
No EOL
2.8 KiB
YAML
79 lines
No EOL
2.8 KiB
YAML
name: Update Roadmap Released
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [closed]
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 */6 * * *"
|
|
|
|
permissions:
|
|
pull-requests: read
|
|
contents: read
|
|
issues: write
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Update "Released" section with last 10 merged PRs
|
|
uses: actions/github-script@v7
|
|
env:
|
|
ROADMAP_ISSUE_NUMBER: "459"
|
|
with:
|
|
script: |
|
|
const issue_number = parseInt(process.env.ROADMAP_ISSUE_NUMBER, 10);
|
|
const {owner, repo} = context.repo;
|
|
|
|
// Fetch more than 10, then sort by closed_at to be precise
|
|
const batchSize = 50;
|
|
const { data: prBatch } = await github.rest.pulls.list({
|
|
owner,
|
|
repo,
|
|
state: "closed",
|
|
per_page: batchSize,
|
|
sort: "updated",
|
|
direction: "desc"
|
|
});
|
|
|
|
const last10 = prBatch
|
|
.filter(pr => pr.merged_at) // only merged PRs
|
|
.sort((a, b) => new Date(b.merged_at) - new Date(a.merged_at))
|
|
.slice(0, 10);
|
|
|
|
const list = last10.map(pr => `- #${pr.number}`).join("\n");
|
|
|
|
const start = "<!-- RELEASED:START -->";
|
|
const end = "<!-- RELEASED:END -->";
|
|
|
|
const mergedUrl = `https://github.com/${owner}/${repo}/pulls?q=is%3Apr+is%3Amerged`;
|
|
const replacementBlock = [
|
|
start,
|
|
"",
|
|
`10 most recent [merged PRs](${mergedUrl}):`,
|
|
"",
|
|
list,
|
|
"",
|
|
end
|
|
].join("\n");
|
|
|
|
const { data: issue } = await github.rest.issues.get({ owner, repo, issue_number });
|
|
let body = issue.body || "";
|
|
|
|
if (body.includes(start) && body.includes(end)) {
|
|
const pattern = new RegExp(`${start}[\\s\\S]*?${end}`);
|
|
body = body.replace(pattern, replacementBlock);
|
|
} else {
|
|
core.setFailed('Missing RELEASED markers in roadmap issue body. Please add <!-- RELEASED:START --> and <!-- RELEASED:END --> to the issue.');
|
|
return;
|
|
}
|
|
|
|
await github.rest.issues.update({
|
|
owner,
|
|
repo,
|
|
issue_number,
|
|
body
|
|
}); |