-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#0: Added github community issue workflow
- Loading branch information
1 parent
b5e0888
commit 5867719
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: "Slack Notification on Community Issue" | ||
|
||
on: | ||
push: | ||
issues: | ||
types: [opened, labeled] | ||
|
||
jobs: | ||
label-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check issue labels | ||
id: label-check | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const issue = context.payload.issue; | ||
if (!issue || issue.pull_request) { | ||
console.log("This event is not an issue or is a pull request."); | ||
return false; | ||
} | ||
const labels = context.payload.issue.labels.map(label => label.name); | ||
const requiredLabel = "community"; | ||
const hasRequiredLabel = labels.includes(requiredLabel); | ||
return hasRequiredLabel; | ||
- name: Send Slack Notification | ||
if: steps.label-check.outputs.result == 'true' | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "A new issue with the 'community' label has been created by `${{ github.event.sender.login }}`: ${{ github.event.issue.html_url }}", | ||
"channel": "" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHANNEL_WEBHOOK_URL }} |