-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathadd-comment-to-recruit-issues.yml
More file actions
45 lines (43 loc) · 1.56 KB
/
add-comment-to-recruit-issues.yml
File metadata and controls
45 lines (43 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Add comment to all issues
permissions:
issues: write
on:
workflow_dispatch: # Allows manual trigger
jobs:
add_comments:
runs-on: ubuntu-latest
steps:
- name: Add comment to all issues with only 'recruit-completed' label
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_PAT }}
script: |
const owner = 'microsoft';
const repo = 'agent-academy';
// Get all open issues with the label 'recruit-completed'
const issues = await github.paginate(
github.rest.issues.listForRepo,
{
owner,
repo,
state: 'open',
labels: 'recruit-completed',
per_page: 100
}
);
for (const issue of issues) {
// Only process if the issue is NOT a PR and has ONLY the 'recruit-completed' label
if (
!issue.pull_request &&
Array.isArray(issue.labels) &&
issue.labels.length === 1 &&
issue.labels[0].name === 'recruit-completed'
) {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'Thank you for filling out the Recruit Completion Form. In order to collect your digital badge, you must submit the following Badge Validation Form: https://aka.ms/agent-academy-recruit/form.'
});
}
}