The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Link Claude Bugfix PR to Linear issue (#67710)
Fraser0ed6c4deed5d
diff --git a/.github/scripts/find-linear-issue.js b/.github/scripts/find-linear-issue.jsnew file mode 100644index 00000000000..87b3cd5ab63--- /dev/null+++ b/.github/scripts/find-linear-issue.js@@ -0,0 +1,40 @@+async function findLinearIssue({ githubIssueUrl, linearApiKey }) {+ const response = await fetch("https://api.linear.app/graphql", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ Authorization: linearApiKey,+ },+ body: JSON.stringify({+ query: `+ query {+ attachmentsForURL(url: "${githubIssueUrl}") {+ nodes {+ issue { identifier }+ }+ }+ }+ `,+ }),+ });++ const data = await response.json();++ if (!response.ok) {+ return { success: false, message: `Linear API error: ${response.status}` };+ }++ if (!data.data?.attachmentsForURL?.nodes?.length) {+ return {+ success: false,+ message: `No Linear issue linked to ${githubIssueUrl}`,+ };+ }++ return {+ success: true,+ issue: data.data.attachmentsForURL.nodes[0].issue.identifier,+ };+}++module.exports = { findLinearIssue };diff --git a/.github/workflows/claude-code-bug-fix.yml b/.github/workflows/claude-code-bug-fix.ymlindex 6f6294c86ee..a46b3df0fb4 100644--- a/.github/workflows/claude-code-bug-fix.yml+++ b/.github/workflows/claude-code-bug-fix.yml@@ -70,6 +70,31 @@ jobs:core.setFailed(error.message);}+ - name: Find linked Linear issue+ id: find_linear+ continue-on-error: true+ uses: actions/github-script@v7+ env:+ LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}+ ISSUE_NUMBER: ${{ steps.get_issue.outputs.issue_number }}+ with:+ script: |+ const { findLinearIssue } = require('${{ github.workspace }}/.github/scripts/find-linear-issue.js');++ const githubIssueUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${process.env.ISSUE_NUMBER}`;++ const result = await findLinearIssue({+ githubIssueUrl,+ linearApiKey: process.env.LINEAR_API_KEY+ });++ if (result.success) {+ console.log(`Found Linear issue: ${result.issue}`);+ core.setOutput('linear_issue', result.issue);+ } else {+ console.log(`Could not find Linear issue: ${result.message}`);+ }+- name: Set up git configurationrun: |git config --global user.name "Claude Code[bot]"@@ -259,6 +284,7 @@ jobs:core.setOutput('reviewers', issueCreator);- name: Create Pull Request+ id: create_prif: steps.check_changes.outputs.has_changes == 'true'uses: peter-evans/create-pull-request@v6with:@@ -279,6 +305,8 @@ jobs:body: |This PR automatically fixes the bug reported in #${{ env.ISSUE_NUMBER }}.+ ${{ steps.find_linear.outputs.linear_issue && format('Closes {0}', steps.find_linear.outputs.linear_issue) || '' }}+## Bug Report**Original Issue:** #${{ env.ISSUE_NUMBER }}**Reporter:** @${{ env.ISSUE_AUTHOR }}@@ -299,7 +327,6 @@ jobs:- If issues are found, either fix them or close this PR---- Closes #${{ env.ISSUE_NUMBER }}🤖 Generated with [Claude Code](https://claude.ai/code)@@ -309,6 +336,7 @@ jobs:automated-fixci skipreviewers: ${{ steps.prepare_reviewers.outputs.reviewers }}+ assignees: ${{ github.actor }}- name: Log existing branch updateif: steps.check_changes.outputs.has_changes == 'true' && env.BRANCH_EXISTS == 'true'