Skip to content

Commit

Permalink
ci: add email sending to TSC notify workflow and new scripts concept (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Oct 27, 2022
1 parent b2090a8 commit 9ea9575
Show file tree
Hide file tree
Showing 8 changed files with 1,343 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/global-replicator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:

replicate_generic_workflows:
if: startsWith(github.repository, 'asyncapi/')
name: Replicate generic workflows needed for any project
name: Replicate generic workflows and scripts needed for any project
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -95,7 +95,7 @@ jobs:
uses: derberg/copy-files-to-other-repositories@v1
with:
github_token: ${{ secrets.GH_TOKEN }}
patterns_to_include: .github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/sentiment-analysis.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/link-check-cron.yml,.github/workflows/link-check-pr.yml
patterns_to_include: .github/workflows/scripts,.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml,.github/workflows/add-good-first-issue-labels.yml,.github/workflows/automerge-for-humans-merging.yml,.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml,.github/workflows/automerge-orphans.yml,.github/workflows/automerge.yml,.github/workflows/autoupdate.yml,.github/workflows/help-command.yml,.github/workflows/issues-prs-notifications.yml,.github/workflows/lint-pr-title.yml,.github/workflows/notify-tsc-members-mention.yml,.github/workflows/sentiment-analysis.yml,.github/workflows/stale-issues-prs.yml,.github/workflows/welcome-first-time-contrib.yml,.github/workflows/release-announcements.yml,.github/workflows/link-check-cron.yml,.github/workflows/link-check-pr.yml
committer_username: asyncapi-bot
committer_email: [email protected]
commit_message: "ci: update generic workflows"
Expand All @@ -116,4 +116,4 @@ jobs:
patterns_to_include: .github/workflows/if-docker-pr-testing.yml
committer_username: asyncapi-bot
committer_email: [email protected]
commit_message: "ci: update workflows for docker-based projects"
commit_message: "ci: update workflows for docker-based projects"
166 changes: 164 additions & 2 deletions .github/workflows/notify-tsc-members-mention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo

# This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository
name: Notify slack whenever TSC members are mentioned in GitHub
name: Notify slack and email subscribers whenever TSC members are mentioned in GitHub

on:
issue_comment:
Expand Down Expand Up @@ -38,6 +38,9 @@ jobs:
name: TSC notification on every new issue
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: issuemarkdown
Expand All @@ -50,12 +53,39 @@ jobs:
SLACK_TITLE: 🆘 New issue that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.issue.html_url}}');
pull_request:
if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body, '@asyncapi/tsc_members')
name: TSC notification on every new pull request
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: prmarkdown
Expand All @@ -68,12 +98,39 @@ jobs:
SLACK_TITLE: 🆘 New PR that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.pull_request.html_url}}');
discussion:
if: github.event_name == 'discussion' && contains(github.event.discussion.body, '@asyncapi/tsc_members')
name: TSC notification on every new discussion
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: discussionmarkdown
Expand All @@ -86,12 +143,39 @@ jobs:
SLACK_TITLE: 🆘 New discussion that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.discussion.html_url}}');
issue_comment:
if: ${{ github.event_name == 'issue_comment' && !github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') }}
name: TSC notification on every new comment in issue
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: issuemarkdown
Expand All @@ -104,12 +188,39 @@ jobs:
SLACK_TITLE: 🆘 New comment under existing issue that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.comment.html_url}}');
pr_comment:
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members')
name: TSC notification on every new comment in pr
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: prmarkdown
Expand All @@ -122,12 +233,39 @@ jobs:
SLACK_TITLE: 🆘 New comment under existing PR that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}}
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.comment.html_url}}');
discussion_comment:
if: github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@asyncapi/tsc_members')
name: TSC notification on every new comment in discussion
runs-on: ubuntu-latest
steps:
#########
# Handling Slack notifications
#########
- name: Convert markdown to slack markdown
uses: LoveToKnow/[email protected]
id: discussionmarkdown
Expand All @@ -139,4 +277,28 @@ jobs:
SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}}
SLACK_TITLE: 🆘 New comment under existing discussion that requires TSC Members attention 🆘
SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}}
MSG_MINIMAL: true
MSG_MINIMAL: true
#########
# Handling Mailchimp notifications
#########
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install deps
run: npm install
working-directory: ./.github/workflows/scripts/mailchimp
- name: Send email with MailChimp
uses: actions/github-script@v4
env:
CALENDAR_ID: ${{ secrets.CALENDAR_ID }}
CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }}
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }}
with:
script: |
const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js');
sendEmail('${{github.event.comment.html_url}}');
1 change: 1 addition & 0 deletions .github/workflows/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The entire `scripts` directory is centrally managed in [.github](https://github.com/asyncapi/.github/) repository. Any changes in this folder should be done in central repository.
Loading

0 comments on commit 9ea9575

Please sign in to comment.