name: Issue Labeled env: BUN_VERSION: 1.1.44 on: issues: types: [labeled] jobs: # on-bug: # runs-on: ubuntu-latest # if: github.event.label.name == 'bug' || github.event.label.name == 'crash' # permissions: # issues: write # steps: # - name: Checkout # uses: actions/checkout@v4 # with: # sparse-checkout: | # scripts # .github # CMakeLists.txt # - name: Setup Bun # uses: ./.github/actions/setup-bun # with: # bun-version: ${{ env.BUN_VERSION }} # - name: "categorize bug" # id: add-labels # env: # GITHUB_ISSUE_BODY: ${{ github.event.issue.body }} # GITHUB_ISSUE_TITLE: ${{ github.event.issue.title }} # ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} # shell: bash # run: | # echo '{"dependencies": { "@anthropic-ai/sdk": "latest" }}' > scripts/package.json && bun install --cwd=./scripts # LABELS=$(bun scripts/label-issue.ts) # echo "labels=$LABELS" >> $GITHUB_OUTPUT # - name: Add labels # uses: actions-cool/issues-helper@v3 # if: steps.add-labels.outputs.labels != '' # with: # actions: "add-labels" # token: ${{ secrets.GITHUB_TOKEN }} # issue-number: ${{ github.event.issue.number }} # labels: ${{ steps.add-labels.outputs.labels }} on-labeled: runs-on: ubuntu-latest if: github.event.label.name == 'crash' || github.event.label.name == 'needs repro' permissions: issues: write steps: - name: Checkout uses: actions/checkout@v4 with: sparse-checkout: | scripts .github CMakeLists.txt - name: Setup Bun uses: ./.github/actions/setup-bun with: bun-version: ${{ env.BUN_VERSION }} - name: "add platform and command label" id: add-labels if: github.event.label.name == 'crash' env: GITHUB_ISSUE_BODY: ${{ github.event.issue.body }} GITHUB_ISSUE_TITLE: ${{ github.event.issue.title }} shell: bash run: | LABELS=$(bun scripts/read-issue.ts) bun scripts/is-outdated.ts if [[ -f "is-outdated.txt" ]]; then echo "is-outdated=true" >> $GITHUB_OUTPUT fi if [[ -f "outdated.txt" ]]; then echo "outdated=$(cat outdated.txt)" >> $GITHUB_OUTPUT fi if [[ -f "is-very-outdated.txt" ]]; then echo "is-very-outdated=true" >> $GITHUB_OUTPUT LABELS="$LABELS,old-version" else echo "is-very-outdated=false" >> $GITHUB_OUTPUT fi echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT echo "labels=$LABELS" >> $GITHUB_OUTPUT rm -rf is-outdated.txt outdated.txt latest.txt is-very-outdated.txt - name: Generate comment text with Sentry Link if: github.event.label.name == 'crash' # ignore if fail continue-on-error: true id: generate-comment-text env: GITHUB_ISSUE_BODY: ${{ github.event.issue.body }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_EVENTS_SECRET }} shell: bash run: | bun scripts/associate-issue-with-sentry.ts if [[ -f "sentry-link.txt" ]]; then echo "sentry-link=$(cat sentry-link.txt)" >> $GITHUB_OUTPUT fi if [[ -f "sentry-id.txt" ]]; then echo "sentry-id=$(cat sentry-id.txt)" >> $GITHUB_OUTPUT fi - name: Remove old labels uses: actions-cool/issues-helper@v3 if: github.event.label.name == 'crash' && steps.add-labels.outputs.is-very-outdated == 'false' with: actions: "remove-labels" token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} labels: old-version - name: Add labels uses: actions-cool/issues-helper@v3 if: github.event.label.name == 'crash' with: actions: "add-labels" token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} labels: ${{ steps.add-labels.outputs.labels }} - name: Comment outdated if: steps.add-labels.outputs.is-outdated == '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 this crash was reported on Bun v${{ steps.add-labels.outputs.outdated }}. Are you able to reproduce this crash on the latest version of Bun? ```sh bun upgrade ``` - 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' 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 this crash was reported on Bun v${{ steps.add-labels.outputs.outdated }}. Are you able to reproduce this crash on the latest version of Bun? ```sh bun upgrade ``` For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}). - name: Comment with Sentry Link if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated != 'true' uses: actions-cool/issues-helper@v3 with: actions: "create-comment" token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | Thank you for reporting this crash. For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}). - name: Comment needs repro if: github.event.label.name == 'needs repro' uses: actions-cool/issues-helper@v3 with: actions: "create-comment" token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun), [CodeSandbox](https://codesandbox.io/templates/bun), or provide a bulleted list of commands to run that reproduce this issue. Issues marked with `needs repro` will be closed if they have no activity within 3 days.