This commit is contained in:
Jarred Sumner
2025-09-12 17:24:47 -07:00
parent 0a3b9ce701
commit bac13201ae
3 changed files with 55 additions and 16 deletions

View File

@@ -123,6 +123,10 @@ jobs:
echo "outdated=$(cat outdated.txt)" >> $GITHUB_OUTPUT
fi
if [[ -f "is-standalone.txt" ]]; then
echo "is-standalone=true" >> $GITHUB_OUTPUT
fi
if [[ -f "is-very-outdated.txt" ]]; then
echo "is-very-outdated=true" >> $GITHUB_OUTPUT
LABELS="$LABELS,old-version"
@@ -132,7 +136,7 @@ jobs:
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
echo "labels=$LABELS" >> $GITHUB_OUTPUT
rm -rf is-outdated.txt outdated.txt latest.txt is-very-outdated.txt
rm -rf is-outdated.txt outdated.txt latest.txt is-very-outdated.txt is-standalone.txt
- name: Close issue if pattern detected
if: github.event.label.name == 'crash' && fromJson(steps.add-labels.outputs.close-action).close == true
uses: actions/github-script@v7
@@ -191,8 +195,17 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: ${{ steps.add-labels.outputs.labels }}
- name: Comment outdated (standalone executable)
if: steps.add-labels.outputs.is-outdated == 'true' && steps.add-labels.outputs.is-standalone == 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
@${{ github.event.issue.user.login }}, the latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but the standalone executable is running Bun v${{ steps.add-labels.outputs.outdated }}. When the CLI using Bun's single-file executable next updates it might be fixed.
- name: Comment outdated
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
if: steps.add-labels.outputs.is-outdated == 'true' && steps.add-labels.outputs.is-standalone != 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
@@ -206,8 +219,22 @@ jobs:
```sh
bun upgrade
```
- name: Comment with Sentry Link and outdated version (standalone executable)
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true' && steps.add-labels.outputs.is-standalone == 'true'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
@${{ github.event.issue.user.login }}, thank you for reporting this crash. The latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but the standalone executable is running Bun v${{ steps.add-labels.outputs.outdated }}. When the CLI using Bun's single-file executable next updates it might be fixed.
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
- name: Comment with Sentry Link and outdated version
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true'
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true' && steps.add-labels.outputs.is-standalone != 'true'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment"

View File

@@ -36,15 +36,17 @@ better-sqlite3 is not supported yet in Bun due to missing V8 C++ APIs. For now,
// Check for CPU architecture issues (Segmentation Fault/Illegal Instruction with no_avx)
else if (
(body.includes("Segmentation Fault") ||
body.includes("Illegal Instruction") ||
body.includes("IllegalInstruction")) &&
body.includes("Illegal Instruction") ||
body.includes("IllegalInstruction")) &&
body.includes("no_avx")
) {
let comment = `Bun requires a CPU with the micro-architecture [\`nehalem\`](https://en.wikipedia.org/wiki/Nehalem_(microarchitecture)) or later (released in 2008). If you're using a CPU emulator like qemu, then try enabling x86-64-v2.`;
// Check if it's macOS
const platformMatch = body.match(/Platform:\s*([^\n]+)/i) || body.match(/on\s+(macos|darwin)/i);
const isMacOS = platformMatch && (platformMatch[1]?.toLowerCase().includes("darwin") || platformMatch[1]?.toLowerCase().includes("macos"));
const isMacOS =
platformMatch &&
(platformMatch[1]?.toLowerCase().includes("darwin") || platformMatch[1]?.toLowerCase().includes("macos"));
if (isMacOS) {
comment += `\n\nIf you're on a macOS silicon device, you're running Bun via the Rosetta CPU emulator and your best option is to run Bun natively instead.`;
@@ -58,11 +60,13 @@ else if (
if (closeAction) {
// Output the action to take
console.write(JSON.stringify({
close: true,
reason: closeAction.reason,
comment: closeAction.comment,
}));
console.write(
JSON.stringify({
close: true,
reason: closeAction.reason,
comment: closeAction.comment,
}),
);
} else {
console.write(JSON.stringify({ close: false }));
}

View File

@@ -6,6 +6,9 @@ if (!body) {
const latest = (await Bun.file(join(import.meta.dir, "..", "LATEST")).text()).trim();
// Check if this is a standalone executable
const isStandalone = body.includes("standalone_executable");
const lines = body.split("\n").reverse();
for (let line of lines) {
@@ -39,6 +42,11 @@ for (let line of lines) {
await Bun.write("is-outdated.txt", "true");
await Bun.write("outdated.txt", version);
// Write flag for standalone executables
if (isStandalone) {
await Bun.write("is-standalone.txt", "true");
}
const isVeryOutdated =
major !== latestMajor || minor !== latestMinor || (latestPatch > patch && latestPatch - patch > 3);