Agent #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Agent" | |
| run-name: "Agent" | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| triage: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v4 | |
| - name: "Search for Repository" | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = "pxt-common-packages"; // your repo name | |
| const issueText = context.payload.issue.title + " " + context.payload.issue.body; | |
| // Build GitHub search query | |
| const query = `repo:${owner}/${repo} "${issueText}"`; | |
| const results = await github.rest.search.code({ q: query }); | |
| let message = ""; | |
| if (results.data.total_count === 0) { | |
| message = "No related files or code were found in this repository."; | |
| } else { | |
| message = `Found **${results.data.total_count}** related matches:\n`; | |
| for (const item of results.data.items) { | |
| message += `- \`${item.path}\`\n`; | |
| } | |
| } | |
| core.setOutput("message", message); | |
| - name: Comment on issue with results | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = `### 🔍 Automated Search Results\n${steps.search.outputs.message}`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }); | |
| env: | |
| token: ${{secrets.GITHUB_TOKEN}} |