mehrancodes / laravel-harbor

a cli tool to Quickly create on-demand preview environment for your app on Laravel Forge.
https://www.laravel-harbor.com
MIT License
75 stars 7 forks source link

Send Slack Notification on Deployment #78

Closed shawnhooper closed 7 months ago

shawnhooper commented 7 months ago

Fixes #77

To test this:

  1. Create a new Slack app. Copy it's OAuth Access token.

  2. Create a new GitHub secret with the OAuth Access token.

  3. Invite the Slack app into the channel where you want to announce the deployments.

  4. Add two new environment variables to the preview-provision.yml workflow:

      SLACK_ANNOUNCEMENT_ENABLED: true
      SLACK_BOT_USER_OAUTH_TOKEN: ${{ secrets.SLACK_BOT_USER_OAUTH_TOKEN }}
      SLACK_CHANNEL: "#deployments"  (replace this with the channel you invited the bot to)
  5. Test a deployment.

The Slack Notification will only be sent when the site is first created. Subsequent pushes to the same PR won't trigger the notification.

shawnhooper commented 7 months ago

image

This is proof of it working in my environment

shawnhooper commented 7 months ago

Thanks @mehrancodes !