-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github Actions for Issues on repo
- Loading branch information
1 parent
279f94c
commit 1110084
Showing
2 changed files
with
78 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,17 @@ | ||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Thank you for reporting! If this is an SDK specific issue, we will look into it and get back to you soon. If this is an API related request, report it in our [Advanced API forum](https://forums.coinbasecloud.dev/c/advanced-trade-api/20) instead.' | ||
}) |
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,61 @@ | ||
name: Slack notifications for PRs and Issues | ||
|
||
on: | ||
issues: | ||
types: [opened, reopened] | ||
|
||
env: | ||
CHANNEL_WALLET_FEEDBACK: ${{ vars.CHANNEL_API_FEEDBACK }} | ||
ON_CALL_API: ${{ vars.ON_CALL_API }} | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
skip: ${{ env.skip }} | ||
steps: | ||
- name: Check spam labels | ||
if: ${{ contains(github.event.*.labels.*.name, 'spam') }} | ||
run: | | ||
echo "skip=true" >> $GITHUB_ENV | ||
echo "::error:: Spam label found." | ||
notify: | ||
runs-on: ubuntu-latest | ||
needs: checks | ||
if: ${{ needs.checks.outputs.skip != 'true' }} | ||
steps: | ||
- name: Set channel and mention | ||
run: | | ||
echo "channel=${{ env.CHANNEL_API_FEEDBACK }}" >> $GITHUB_ENV | ||
echo "mention=${{ env.ON_CALL_API }}" >> $GITHUB_ENV | ||
- name: Set text | ||
run: | | ||
text=$(echo "${{ vars.SLACK_TEMPLATE }}") | ||
text=${text//'{{event}}'/Issue ${{ env.action }}} | ||
text=${text//'{{author}}'/${{ env.author }}} | ||
text=${text//'{{url}}'/${{ env.url }}} | ||
text=${text//'{{mention}}'/${{ env.mention }}} | ||
text=${text//'{{repo}}'/${{ github.repository }}} | ||
text="${text//$'\r\n'/'\n'}" | ||
text="${text//$'\n'/'\n'}" | ||
echo "text=$text" >> $GITHUB_ENV | ||
env: | ||
action: ${{ github.event.action }} | ||
author: ${{ github.event.issue.user.login }} | ||
url: ${{ github.event.issue.html_url }} | ||
|
||
- name: Notify Slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"channel": "#${{ env.channel }}", | ||
"username": "${{ vars.WEBHOOK_USERNAME }}", | ||
"text": "*${{ env.title }}*\n${{ env.text }}", | ||
"icon_emoji": ":${{ vars.ICON_EMOJI }}:" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
title: ${{ github.event.issue.title }} |