Skip to content

Commit

Permalink
#0: Added github community issue workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ayerofieiev-tt committed Jun 28, 2024
1 parent b5e0888 commit 5867719
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/on-community-issue.yaml
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 }}

0 comments on commit 5867719

Please sign in to comment.