bit Boilerplate copilot instructions need improvements #361
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: 'bitplatform wiki' | |
| on: | |
| issues: | |
| types: [opened] | |
| discussion: | |
| types: [created] | |
| jobs: | |
| build-and-comment: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| discussions: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Run wiki query script | |
| id: run-mcp-query | |
| run: | | |
| chmod +x ./.github/workflows/wiki.sh | |
| echo "wiki_url=$(./.github/workflows/wiki.sh)" >> $GITHUB_OUTPUT | |
| env: | |
| ISSUE_TITLE: ${{ github.event.issue.title || github.event.discussion.title }} | |
| ISSUE_BODY: ${{ github.event.issue.body || github.event.discussion.body }} | |
| - name: Write comment | |
| if: steps.run-mcp-query.outputs.wiki_url | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const commentBody = ` | |
| Hello there! I'm a wiki 🤖. | |
| Based on the content of this thread, I've found a potentially relevant wiki page for you! | |
| **✨ [View Wiki Page](${{ steps.run-mcp-query.outputs.wiki_url }})** | |
| I hope this helps! | |
| `; | |
| if (context.eventName === 'issues') { | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: commentBody | |
| }); | |
| } else if (context.eventName === 'discussion') { | |
| const discussionId = context.payload.discussion.node_id; | |
| await github.graphql( | |
| `mutation($discussionId: ID!, $body: String!) { | |
| addDiscussionComment(input: {discussionId: $discussionId, body: $body}) { | |
| comment { | |
| id | |
| } | |
| } | |
| }`, | |
| { | |
| discussionId: discussionId, | |
| body: commentBody | |
| } | |
| ); | |
| } |