-
-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (35 loc) · 1.38 KB
/
issue-comment.yml
File metadata and controls
42 lines (35 loc) · 1.38 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
name: Issue Label Commenter
# This workflow runs when a label is added to an issue or pull request.
on:
issues:
types: [labeled]
pull_request_target:
types: [labeled]
jobs:
comment_on_documentation_label:
runs-on: ubuntu-latest
# Check if the added label matches 'documentation'
if: github.event.label.name == 'documentation'
# Permissions are required to write comments on issues/PRs
permissions:
issues: write
pull-requests: write
steps:
- name: Post Comment for Documentation Label
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issueNumber = context.issue.number;
const issueType = context.payload.issue ? 'issue' : 'pull request';
// Define the message to post
const message = `Thanks for adding the **documentation** label!
<br />
This ${issueType} is now marked as needing content updates for the CodeHarborHub site. Please ensure the description contains all necessary technical details.`;
// Post the comment using the GitHub API
github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});