From 6f8cc6c4fc0052c78fae3fbb05e3d81ba615dc79 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 23:54:29 +0000 Subject: [PATCH 1/3] Initial plan From 525222d08f611a628b9178f2edc713f2aa4042a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 23:55:53 +0000 Subject: [PATCH 2/3] Add Copilot issue Slack notifier workflow and README documentation --- .../copilot-issue-slack-notifier.yml | 81 +++++++++++++++++++ README.md | 35 ++++++++ 2 files changed, 116 insertions(+) create mode 100644 .github/workflows/copilot-issue-slack-notifier.yml diff --git a/.github/workflows/copilot-issue-slack-notifier.yml b/.github/workflows/copilot-issue-slack-notifier.yml new file mode 100644 index 0000000..487c2d8 --- /dev/null +++ b/.github/workflows/copilot-issue-slack-notifier.yml @@ -0,0 +1,81 @@ +name: Copilot Issue Slack Notifier + +on: + issues: + types: [opened] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Check for copilot keyword and notify Slack + uses: actions/github-script@v7 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + with: + script: | + const title = context.payload.issue.title || ''; + const body = context.payload.issue.body || ''; + const combined = `${title} ${body}`; + + if (!/\bcopilot\b/i.test(combined)) { + core.info('No "copilot" keyword found in issue title or body. Skipping notification.'); + return; + } + + const issue = context.payload.issue; + const repo = context.payload.repository; + + const payload = { + channel: '#support-squad-copilot-shiftlog', + text: 'Review release and assign SME', + attachments: [ + { + color: '#0366d6', + fields: [ + { title: 'Repository', value: repo.full_name, short: true }, + { title: 'Author', value: issue.user.login, short: true }, + { title: 'Issue', value: `<${issue.html_url}|${issue.title}>`, short: false } + ] + } + ] + }; + + const webhookUrl = process.env.SLACK_WEBHOOK_URL; + if (!webhookUrl) { + core.setFailed('SLACK_WEBHOOK_URL secret is not set.'); + return; + } + + const https = require('https'); + const data = JSON.stringify(payload); + const url = new URL(webhookUrl); + + await new Promise((resolve, reject) => { + const req = https.request( + { + hostname: url.hostname, + path: url.pathname + url.search, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(data) + } + }, + (res) => { + let body = ''; + res.on('data', (chunk) => { body += chunk; }); + res.on('end', () => { + if (res.statusCode >= 200 && res.statusCode < 300) { + core.info(`Slack notification sent successfully (HTTP ${res.statusCode}).`); + resolve(); + } else { + reject(new Error(`Slack webhook returned HTTP ${res.statusCode}: ${body}`)); + } + }); + } + ); + req.on('error', reject); + req.write(data); + req.end(); + }); diff --git a/README.md b/README.md index 4ef7e11..b35e083 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,37 @@ # release-assets This repository is used to manage assets related to releases in github/releases + +## Copilot Issue Slack Notifier + +The workflow at `.github/workflows/copilot-issue-slack-notifier.yml` automatically sends a Slack notification to **`#support-squad-copilot-shiftlog`** whenever a new issue is opened in this repository that mentions the word **`copilot`** (case-insensitive, whole-word match) in its title or body. + +### How it works + +1. Triggers on the `issues.opened` event. +2. Checks the issue title and body for the whole word `copilot` (e.g. matches *"Copilot bug"* but not *"github-copilots"*). +3. If matched, POSTs a Slack message containing: + - The fixed text `Review release and assign SME` + - Issue title (as a link), author login, and repository name +4. If no match is found, the workflow exits silently — no notification is sent. +5. An empty or missing issue body is handled safely (treated as an empty string). + +### Secret configuration + +Add the following secret to this repository before the workflow can send notifications: + +| Secret name | Description | +|---------------------|--------------------------------------------------------------| +| `SLACK_WEBHOOK_URL` | Incoming Webhook URL for the `#support-squad-copilot-shiftlog` Slack channel | + +To add the secret: **Repository Settings → Secrets and variables → Actions → New repository secret**. + +### Quick test plan + +| Scenario | Issue title | Issue body | Expected result | +|----------|-------------|------------|-----------------| +| Match in title | `Copilot is slow today` | *(any)* | Slack notification sent | +| Match in body | `Performance issue` | `Need copilot assistance` | Slack notification sent | +| Case-insensitive match | `COPILOT integration` | *(any)* | Slack notification sent | +| No match | `Release checklist` | `Deploy new version` | No notification (silent skip) | +| Partial word — no match | `github-copilots` | *(empty)* | No notification (whole-word only) | +| Empty body | `Copilot question` | *(empty/null)* | Slack notification sent (title matched) | From 3598362b2fe9cb1d7a9412658d0f2a5c0aa2f155 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 23:56:22 +0000 Subject: [PATCH 3/3] Fix partial-word example in README test plan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b35e083..0a09948 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,5 @@ To add the secret: **Repository Settings → Secrets and variables → Actions | Match in body | `Performance issue` | `Need copilot assistance` | Slack notification sent | | Case-insensitive match | `COPILOT integration` | *(any)* | Slack notification sent | | No match | `Release checklist` | `Deploy new version` | No notification (silent skip) | -| Partial word — no match | `github-copilots` | *(empty)* | No notification (whole-word only) | +| Partial word — no match | `github-copilot` | *(empty)* | No notification (whole-word only) | | Empty body | `Copilot question` | *(empty/null)* | Slack notification sent (title matched) |