From 5e9604112e3804d4a11acb0b8d93e23a80532e9c Mon Sep 17 00:00:00 2001 From: "geoffroy.jabouley" Date: Mon, 16 Sep 2024 10:45:52 +0200 Subject: [PATCH] Enable new issue workflow for maintainers notification --- .../ISSUE_TEMPLATE/default-issue-template.md | 13 -------- .github/workflows/new_issue_notification.yml | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/default-issue-template.md create mode 100644 .github/workflows/new_issue_notification.yml diff --git a/.github/ISSUE_TEMPLATE/default-issue-template.md b/.github/ISSUE_TEMPLATE/default-issue-template.md deleted file mode 100644 index 6004e59..0000000 --- a/.github/ISSUE_TEMPLATE/default-issue-template.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Default issue template -about: Default issue template to notify maintainers team -title: '' -labels: '' -assignees: '' - ---- - -_Your text here_ - ---- -Notify: @tdk-invn-oss/motion-maintainers diff --git a/.github/workflows/new_issue_notification.yml b/.github/workflows/new_issue_notification.yml new file mode 100644 index 0000000..af879c1 --- /dev/null +++ b/.github/workflows/new_issue_notification.yml @@ -0,0 +1,32 @@ +name: Comment on New Issue to Notify Code Owners + +on: + issues: + types: [opened] + +jobs: + comment: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Get CODEOWNERS + id: get-codeowners + run: | + sed -ne "s/^\* \(.*\)/CODEOWNERS=\1/p;" CODEOWNERS > "$GITHUB_OUTPUT" + + - name: Comment on the new issue + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.BOT_ACCOUNT_PAT }} + script: | + const issueNumber = context.issue.number; + const commentBody = "Thank you for opening this issue! We will look into it shortly.

Notifying ${{ steps.get-codeowners.outputs.CODEOWNERS }}"; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: commentBody + });