All Projects β†’ crazymanish β†’ fastlane-plugin-slack_bot

crazymanish / fastlane-plugin-slack_bot

Licence: MIT license
A Fastlane plugin to customize your automation workflow(s) with a Slack Bot πŸ€–πŸš€

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to fastlane-plugin-slack bot

fastlane-plugin-run tests firebase testlab
Runs Android tests in Firebase Test Lab πŸš€
Stars: ✭ 46 (+76.92%)
Mutual labels:  fastlane, fastlane-plugins
Localizr
Localizr is a Tool that handles and automates the generation of localization files for IOS and Android so there will be only one source of truth for all of your localization strings.
Stars: ✭ 33 (+26.92%)
Mutual labels:  fastlane
Xcfit
Full Stack Protocol Oriented BDD in Xcode for iOS app with Swift using XCUITest, Cucumberish and FitNesse
Stars: ✭ 170 (+553.85%)
Mutual labels:  fastlane
Trainer
Convert xcodebuild plist and xcresult files to JUnit reports
Stars: ✭ 216 (+730.77%)
Mutual labels:  fastlane
React Native Boilerplate
A React Native template for building solid applications πŸ™, using JavaScript πŸ’› or Typescript πŸ’™ (you choose).
Stars: ✭ 2,669 (+10165.38%)
Mutual labels:  fastlane
Galwaybus
Galway Bus Kotlin Multiplatform project using Jetpack Compose and SwiftUI
Stars: ✭ 220 (+746.15%)
Mutual labels:  fastlane
Clendar
Clendar - universal calendar app. Written in SwiftUI. Available on App Store
Stars: ✭ 153 (+488.46%)
Mutual labels:  fastlane
expense-manager
Developers : Checkout this repo for complete CI-CD of flutter with fastlane. Android/iOS both apps are getting deployed on stores with Fastlane.
Stars: ✭ 28 (+7.69%)
Mutual labels:  fastlane
fastlane-plugin-validate app
Validate your app with altool before uploading to iTunes Connect
Stars: ✭ 16 (-38.46%)
Mutual labels:  fastlane
Fastlane Plugin Test center
🎯 The best fastlane plugin to understand and tame misbehaving iOS tests πŸŽ‰
Stars: ✭ 214 (+723.08%)
Mutual labels:  fastlane
App
An easy way to connect with fellow developers during WWDC
Stars: ✭ 188 (+623.08%)
Mutual labels:  fastlane
Fastlane Plugin Changelog
Automate changes to your project CHANGELOG.md
Stars: ✭ 176 (+576.92%)
Mutual labels:  fastlane
Screenshots
Screenshots: A command line utility and package for capturing screenshots for Flutter
Stars: ✭ 225 (+765.38%)
Mutual labels:  fastlane
Swifthub
GitHub iOS client in RxSwift and MVVM-C clean architecture
Stars: ✭ 2,330 (+8861.54%)
Mutual labels:  fastlane
birthtalk
Meet who have birth common with you
Stars: ✭ 36 (+38.46%)
Mutual labels:  fastlane
Upcomingmovies
Movies app written in Swift 5 using the TMDb API and demonstrating Clean Architecture, Dependency Injection, MVVM and Coordinators.
Stars: ✭ 160 (+515.38%)
Mutual labels:  fastlane
Letteravatarkit
πŸ“¦ An extension that generates letter-based avatars/placeholders
Stars: ✭ 180 (+592.31%)
Mutual labels:  fastlane
Docs
All the fastlane docs
Stars: ✭ 216 (+730.77%)
Mutual labels:  fastlane
on-demand-delivery-fastlane-slack
iOS On-Demand delivery architecture via slack/jenkins/fastlane. Demo project for: #PragmaConf2019
Stars: ✭ 18 (-30.77%)
Mutual labels:  fastlane
pedax
Reversi Board with edax, which is the strongest reversi engine.
Stars: ✭ 18 (-30.77%)
Mutual labels:  fastlane

Fastlane slack_bot plugin

fastlane Plugin Badge ![License] Gem Version Twitter: @manish

A fastlane plugin to customize your automation workflow(s) with a Slack Bot πŸ€– using the Slack APIs

About

A fastlane plugin to post slack message and much more using Slack bot api token. πŸš€
Note: Fastlane comes with built-in slack action by default, which uses slack webhook url and have webhook limitations.
i.e Listing couple of slack webhook url limitations:

  • can't post a direct message to a slack user.
  • can’t post a message inside a slack thread.
  • can’t update a posted slack message.
  • can’t list and upload a file inside a slack channel.
  • many more, compare to a Slack Bot πŸ€– using the Slack APIs

Getting Started

  1. Generate Slack token for Fastlane bot

    • Add a slack Bot user
    • Choose a name for your bot, e.g. "fastlane"
    • Save API Token
  2. Add plugin in your project

fastlane add_plugin slack_bot

If you are using fastlane using Gemfile in your project, add it to your project by running:

bundle exec fastlane add_plugin slack_bot
  1. Use slack_bot features inside your lane in Fastfile whenever you want.

Features

Using this slack_bot plugin, you can:

  • Post a message using chat.postMessage Slack API

    • Post a message to a public channel
    • Post a message to a private channel
    • Post a message to a slack user (DM)
    • Post a message inside a slack thread 🧡
    • Post a message with custom Bot username and icon
  • Update a message using chat.update Slack API

    • update a message in a channel
  • List of files in a channel using files.list Slack API

    • A list of files in a channel, It can be filtered and sliced in various ways.
  • Upload a file using files.upload Slack API

    • Upload a file to a public channel
    • Upload a file to a private channel
    • Upload a file to a slack user (DM)
    • Upload a file inside a slack thread 🧡
    • Upload a file with multiple channels/users

Examples (Post a message)

Let’s post a message to the default slack bot channel.

# share on Slack
post_to_slack(message: "App successfully released!")

Let’s post a direct message to a slack user that unit tests CI has been failed.

# share on Slack
post_to_slack(
  message: "CI: Your unit tests on #{ENV['CI_COMMIT_REF_NAME']} failed",
  channel: "@SlackUsername" # This can be Slack userID, instead of username i.e @UXXXXX
)

Let’s post a slack message to the #ios-team channel about the new test-flight build.

lane :beta do
  gym # Build the app and create .ipa file
  pilot # Upload build to TestFlight

  version_number = get_version_number # Get project version
  build_number = get_build_number # Get build number
  beta_release_name = "#{version_number}-#{build_number}-beta-release"

  # share on Slack
  post_to_slack(
    message: "Hi team, we have a new test-flight beta build: #{beta_release_name}",
    channel: "#ios-team"
  )
end

Let’s post a slack message with custom payload.

# share on Slack
post_to_slack(
  api_token: "xyz", # Preferably configure as ENV['SLACK_API_TOKEN']
  message: "App successfully released!",
  channel: "#channel",  # Optional, by default will post to the default channel configured for the Slack Bot.
  success: true,        # Optional, defaults to true.
  payload: {  # Optional, lets you specify any number of your own Slack attachments.
    "Build Date" => Time.new.to_s,
    "Built by" => "Jenkins",
  },
  default_payloads: [:git_branch, :git_author], # Optional, lets you specify an allowlist of default payloads to include. Pass an empty array to suppress all the default payloads.
        # Don't add this key, or pass nil, if you want all the default payloads. The available default payloads are: `lane`, `test_result`, `git_branch`, `git_author`, `last_git_commit`, `last_git_commit_hash`.
  attachment_properties: { # Optional, lets you specify any other properties available for attachments in the slack API (see https://api.slack.com/docs/attachments).
       # This hash is deep merged with the existing properties set using the other properties above. This allows your own fields properties to be appended to the existing fields that were created using the `payload` property for instance.
    thumb_url: "http://example.com/path/to/thumb.png",
    fields: [{
      title: "My Field",
      value: "My Value",
      short: true
    }]
  }
)

Let’s post a slack message inside a slack thread 🧡

lane :release do
  # Start the release with slack release thread
  release_thread = post_to_slack(
    message: "Good morning team, CI has started the AppStore release. You can find more information inside this thread 🧡",
    channel: "#ios-team"
  )

  # Important: Save this slack thread timestamp for futher slack messages
  release_thread_ts = release_thread[:json]["ts"]

  gym # Build the app and create .ipa file

  # Post an update in release thread
  post_to_slack(
    message: "App has been build successfully! πŸ’ͺ",
    channel: "#ios-team",
    thread_ts: release_thread_ts
  )

  deliver # Upload build to AppStore

  # Post an update in release thread
  post_to_slack(
    message: "App has been uploaded to the AppStore and submitted for Apple's review! πŸš€",
    channel: "#ios-team",
    thread_ts: release_thread_ts
  )
end

Let’s post a message with custom slack bot username and icon

# share on Slack
post_to_slack(
  message: "App successfully released!",
  username: "Release Bot", # Overrides the bot's username
  icon_url: "https://fastlane.tools/assets/img/fastlane_icon.png" # Overrides the bot's icon
)

Examples (Upload a file)

Let’s Upload a file to a slack channel that main branch unit tests has been failed, see scan logs.

# File upload on Slack
file_upload_to_slack(
  initial_comment: "CI: main-branch unit tests failed",
  file_path: "scan.log",
  channels: "#ios-team" # Comma-separated list of slack #channel names where the file will be shared
)

Let’s Upload a file to a slack user that your branch unit tests has been failed, see scan logs.

# File upload on Slack
file_upload_to_slack(
  initial_comment: "CI: Your unit tests on #{ENV['CI_COMMIT_REF_NAME']} failed",
  file_path: "scan.log",
  channels: "@SlackUsername" # This can be Slack userID, instead of username i.e @UXXXXX
)

Let’s Upload a file inside a slack thread 🧡

lane :release do
  # Start the release with slack release thread
  release_thread = post_to_slack(
    message: "Good morning team, CI has started the AppStore release. You can find more information inside this thread 🧡",
    channel: "#ios-team"
  )

  # Important: Save this slack thread timestamp for futher slack messages
  release_thread_ts = release_thread[:json]["ts"]

  gym # Build the app and create .ipa file

  # Post an update in release thread
  post_to_slack(
    message: "App has been build successfully! πŸ’ͺ",
    channel: "#ios-team",
    thread_ts: release_thread_ts
  )

  deliver # Upload build to AppStore

  # Post an update in release thread
  post_to_slack(
    message: "App has been uploaded to the AppStore and submitted for Apple's review! πŸš€",
    channel: "#ios-team",
    thread_ts: release_thread_ts
  )

  # Spaceship logs file upload on Slack
  file_upload_to_slack(
    initial_comment: "Deliver:: Spaceship logs",
    file_path: "spaceship.log",
    channels: "#ios-team",
    thread_ts: release_thread_ts
  )
end

About Fastlane

fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].