Skip to content

Commit fb97391

Browse files
authored
Create issue-comment.yml
1 parent 2a83280 commit fb97391

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Issue Label Commenter
2+
3+
# This workflow runs when a label is added to an issue or pull request.
4+
on:
5+
issues:
6+
types: [labeled]
7+
pull_request_target:
8+
types: [labeled]
9+
10+
jobs:
11+
comment_on_documentation_label:
12+
runs-on: ubuntu-latest
13+
14+
# Check if the added label matches 'documentation'
15+
if: github.event.label.name == 'documentation'
16+
17+
# Permissions are required to write comments on issues/PRs
18+
permissions:
19+
issues: write
20+
pull-requests: write
21+
22+
steps:
23+
- name: Post Comment for Documentation Label
24+
uses: actions/github-script@v7
25+
with:
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
script: |
28+
const issueNumber = context.issue.number;
29+
const issueType = context.payload.issue ? 'issue' : 'pull request';
30+
31+
// Define the message to post
32+
const message = `👋 Thanks for adding the **documentation** label!
33+
34+
This ${issueType} is now marked as needing content updates for the CodeHarborHub site. Please ensure the description contains all necessary technical details.`;
35+
36+
// Post the comment using the GitHub API
37+
github.rest.issues.createComment({
38+
issue_number: issueNumber,
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
body: message
42+
});

0 commit comments

Comments
 (0)