name: slack-notification

on:
  pull_request:
    types: [opened]
  pull_request_review:
    types: [submitted]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened]
  issue_comment:
    types: [created]

jobs:
  slack-notification:
    runs-on: ubuntu-latest
    name: Sends a message to Slack when a pull request or an issue is made
    steps:
      - name: Send message to Slack API
        uses: archive/github-actions-slack@master
        with:
          slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
          slack-channel: ${{ secrets.SLACK_BOT_CHANNEL }}
          slack-text: A new <https://github.com/${{ github.repository }}|${{ github.event_name }}> was made in *${{ github.repository }}*.
          slack-optional-icon_emoji: ":robot_face:"
      - name: Result from "Send Message"
        run: echo "The result was ${{ steps.notify.outputs.slack-result }}"

name: slack-notification

on:
  pull_request:
    types: [opened]
  pull_request_review:
    types: [submitted]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened]
  issue_comment:
    types: [created]

jobs:
  slack-notification:
    runs-on: ubuntu-latest
    name: Sends a message to Slack when a pull request or an issue is made
    steps:
      - name: Send message to Slack API
        # if: github.event_name == 'pull_request'
        uses: archive/github-actions-slack@master
        with:
          slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
          slack-channel: ${{ secrets.SLACK_BOT_CHANNEL }}
          slack-text: A new <https://github.com/${{ github.repository }}|Pull Request> was made in *${{ github.repository }}*.
          slack-optional-blocks: fromJSON([
  {
    "type": "section",
    "text": {
      "type": "mrkdwn",
      "text": "A new ${{ github.event_name }} was made in *${{ github.repository }}*"
    },
    "accessory": {
      "type": "button",
      "text": {
        "type": "plain_text",
        "text": "View on GitHub"
      },
      "url": "https://github.com/${{ github.repository }}"
    }
  }
])
      - name: Debug event
          run echo ${{toJSON(github.event)}}
      - name: Result from "Send Message"
        run: echo "The result was ${{ steps.notify.outputs.slack-result }}"



Add slack block to message
Add slack block to message
