Skip to content

Commit 7755a05

Browse files
committed
A bunch of devin review issues fixed
1 parent 579248d commit 7755a05

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

.github/workflows/changesets-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
6666
# Enhance the PR body with a clean, deduplicated summary
6767
RAW_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body')
68-
ENHANCED_BODY=$(echo "$RAW_BODY" | CHANGESET_PR_BODY="$RAW_BODY" node scripts/enhance-release-pr.mjs "$VERSION")
68+
ENHANCED_BODY=$(CHANGESET_PR_BODY="$RAW_BODY" node scripts/enhance-release-pr.mjs "$VERSION")
6969
if [ -n "$ENHANCED_BODY" ]; then
7070
gh api repos/triggerdotdev/trigger.dev/pulls/"$PR_NUMBER" \
7171
-X PATCH \

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ jobs:
186186
GENERIC_URL="https://github.com/triggerdotdev/trigger.dev/pkgs/container/trigger.dev"
187187
188188
# Get current release body and replace the generic link with the tag-specific one
189-
CURRENT_BODY=$(gh release view "${TAG}" --json body --jq '.body')
190-
UPDATED_BODY="${CURRENT_BODY//$GENERIC_URL/$DOCKER_URL}"
189+
gh release view "${TAG}" --json body --jq '.body' > /tmp/release-body.md
190+
sed -i "s|${GENERIC_URL}|${DOCKER_URL}|g" /tmp/release-body.md
191191
192-
gh release edit "${TAG}" --notes "$UPDATED_BODY"
192+
gh release edit "${TAG}" --notes-file /tmp/release-body.md
193193
194194
# The prerelease job needs to be on the same workflow file due to a limitation related to how npm verifies OIDC claims.
195195
prerelease:

scripts/generate-github-release.mjs

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
import { execSync } from "child_process";
20+
import { readdirSync, readFileSync } from "fs";
2021
import { join } from "path";
2122

2223
const version = process.argv[2];
@@ -43,15 +44,25 @@ function extractChangesFromPrBody(body) {
4344
const lines = body.split("\n");
4445
const outputLines = [];
4546
let inDetails = false;
47+
let inSummary = false;
4648
let foundContent = false;
4749

4850
for (const line of lines) {
49-
// Skip the title line (# trigger.dev vX.Y.Z) and Summary section
51+
// Skip the title line (# trigger.dev vX.Y.Z)
5052
if (line.startsWith("# trigger.dev v")) continue;
53+
54+
// Skip the entire Summary section (heading + content until next heading)
5155
if (line.startsWith("## Summary")) {
52-
// Skip the summary line and its content (next non-empty line)
56+
inSummary = true;
5357
continue;
5458
}
59+
if (inSummary) {
60+
if (line.startsWith("## ")) {
61+
inSummary = false;
62+
} else {
63+
continue;
64+
}
65+
}
5566

5667
// Stop before raw changeset output
5768
if (line.trim() === "<details>") {
@@ -112,19 +123,28 @@ function getContributors(previousVersion) {
112123

113124
function getPublishedPackages() {
114125
try {
115-
const config = JSON.parse(
116-
execSync("cat .changeset/config.json", {
117-
cwd: ROOT_DIR,
118-
encoding: "utf-8",
119-
})
120-
);
121-
const fixed = config.fixed?.[0] || [];
122-
return fixed;
126+
const packagesDir = join(ROOT_DIR, "packages");
127+
const names = [];
128+
for (const dir of readdirSync(packagesDir, { withFileTypes: true })) {
129+
if (!dir.isDirectory()) continue;
130+
try {
131+
const pkg = JSON.parse(
132+
readFileSync(join(packagesDir, dir.name, "package.json"), "utf-8")
133+
);
134+
if (pkg.name && !pkg.private) {
135+
names.push(pkg.name);
136+
}
137+
} catch {
138+
// skip directories without package.json
139+
}
140+
}
141+
return names.sort();
123142
} catch {
124143
return [
125-
"@trigger.dev/sdk",
126-
"@trigger.dev/core",
127144
"@trigger.dev/build",
145+
"@trigger.dev/core",
146+
"@trigger.dev/react-hooks",
147+
"@trigger.dev/sdk",
128148
"trigger.dev",
129149
];
130150
}
@@ -137,6 +157,12 @@ function getPreviousVersion(version) {
137157
} else if (parts[1] > 0) {
138158
parts[1]--;
139159
parts[2] = 0;
160+
} else if (parts[0] > 0) {
161+
parts[0]--;
162+
parts[1] = 0;
163+
parts[2] = 0;
164+
} else {
165+
return null;
140166
}
141167
return parts.join(".");
142168
}

0 commit comments

Comments
 (0)