This is an example of how to create a simiple Slack bot using Slack API, then using Github action (CI) to build and push the latest docker image to AWS ECR.
We can using this bot to simple tigger a GitHub action workflow via Slack.
Works by triggering a dispatch workflow on GitHub when a certain command is triggered on Slack, It will then wait poll for until the workflow is finished and send response back to slack.
-
rename
.env.example
file to.env
-
Create a classic app - https://api.slack.com/apps?new_classic_app=1
-
Once app is created, Retrive the OAUTH token and add it to
.env
file -
Create a Github token -> settings -> developer settings -> personal access tokens
-
Add your github token, username and respo name to env variable
-
Must have a repo to trigger the test on, see my example Repo must have docker image on ERC with the workflow to trigger
-
Clone the repo
-
npm install
CLI - Run CLI
node .
you should see status bot started
in your terminal if succesful
Docker - Run on Docker
Build Image
make docker
Run Image
make run
Once its running, headover to to slack and add the bot in to the channel if its not added already. You should see that the bot is online, type in !qa run-cypress
command to trigger the run.
-
Slack API
-
Docker
-
AWS
-
Github Action (CI)