name: Notify when API changes are merged on: pull_request: branches: [ "master" ] types: - closed jobs: if_merged: if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'api changes') runs-on: ubuntu-latest steps: - run: | echo The PR was merged - name: Send Slack notification env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} uses: 8398a7/action-slack@v3 with: status: custom fields: repo,commit,event,action,workflow,ref,url custom_payload: | { "attachments": [ { "color": "${{ job.status }}", "title": "${{ github.actor }} ${{ github.event.pull_request && github.event.pull_request.merged == true && 'merged a pull request' || github.event.pull_request && 'opened a pull request' || github.event_name == 'push' && 'pushed new changes' || github.event_name == 'create' && 'created a new branch or tag' || github.event_name == 'delete' && 'deleted a branch or tag' || github.event_name == 'issues' && github.event.action || 'triggered an event' }}", "text": ":tada: Event details:\n\n- Repository: ${{ github.repository }}\n- Branch: ${{ github.ref }}\n- Message: ${{ github.event_name == 'push' && github.event.head_commit.message || github.event_name == 'issues' && github.event.issue.title || github.event_name == 'pull_request' && github.event.pull_request.title || '' }}\n- :globe_with_meridians: Link: ${{ github.event.pull_request.html_url || github.event.issue.html_url || github.event.repository.html_url }}" } ] }