Skip to content

[Sprint 21] New features and fixes #32

[Sprint 21] New features and fixes

[Sprint 21] New features and fixes #32

name: GH Event Notification
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Get Issue details
if: ${{ github.event_name == 'issues' }}
id: issue_details
env:
TITLE: ${{ github.event.issue.title }}
run: |
echo "type=issue" >> $GITHUB_ENV
echo "title=$TITLE" >> $GITHUB_ENV
echo "user=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
echo "url=${{ github.event.issue.html_url }}" >> $GITHUB_ENV
echo "repo=${{ github.repository }}" >> $GITHUB_ENV
- name: Get PR details
if: ${{ github.event_name == 'pull_request' }}
id: pr_details
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
echo "type=pull_request" >> $GITHUB_ENV
echo "title=$TITLE" >> $GITHUB_ENV
echo "user=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
echo "url=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "repo=${{ github.repository }}" >> $GITHUB_ENV
- name: Send notification to Slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"type": "${{ env.type }}",
"title": "${{ env.title }}",
"user": "${{ env.user }}",
"repo": "${{ env.repo }}",
"url": "${{ env.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_NOTIF_URL }}