Browser control #56
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: Copilot on label | |
| on: | |
| issues: | |
| types: [labeled] | |
| permissions: | |
| issues: write | |
| jobs: | |
| copilot: | |
| # only run when the label that was added is exactly "copilot" | |
| if: github.event.label.name == 'copilot' | |
| runs-on: [self-hosted, linux, x64, big] | |
| steps: | |
| - name: Comment and (optionally) add model label | |
| uses: actions/github-script@v7.1.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const issue_number = context.issue.number; | |
| // 1) Comment to summon Copilot | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number, | |
| body: '@copilot :)' | |
| }); | |
| // 2) Optional: add a model-selection label (only if you want this behavior) | |
| const modelLabel = 'copilot-gpt-5.4'; | |
| // Try to create the label (ignore if it already exists) | |
| try { | |
| await github.rest.issues.createLabel({ | |
| owner, | |
| repo, | |
| name: modelLabel, | |
| color: '5319E7', | |
| description: 'Prefer GPT-5.4 for Copilot (if supported)' | |
| }); | |
| } catch (e) { | |
| // 422 = already exists (or validation). We can safely ignore. | |
| } | |
| // Add the label to the issue if it isn't already present | |
| const existing = new Set(context.payload.issue.labels.map(l => l.name)); | |
| if (!existing.has(modelLabel)) { | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number, | |
| labels: [modelLabel] | |
| }); | |
| } |