This Action allows you to send messages to Flowdock from your Github Actions.
- Flowdock Channel
- A Flowdock App - Which will be used to send messages to your channel.
- A Github Action - the place where you want to send Flowdock messages
- Github Secret - the Flowdock App auth token, used when posting messages to Flowdock API.
Required: Github Repository Secret:
TEAM_FLOW_ACCESS_TOKEN
- This is the Flowdock App token, the credentials for allowing you to send messages from Github to Flowdock.
Required: Github Action Parameters:
-
flowdock-bot-access-token
-TEAM_FLOW_ACCESS_TOKEN
secret -
text
- The text of the message
This will send a Flowdock message every time someone creates pull request.
name: flowdock-notification
on:
pull_request:
branches:
- master
jobs:
flowdock-notifications:
runs-on: ubuntu-latest
name: Sends a message to Flowdock when a pull request is made
steps:
- name: Send message to Flowdock API
uses: DeclanBoller/flowdock-github-action@main
with:
flowdock-bot-access-token: ${{ secrets.TEAM_FLOW_ACCESS_TOKEN }}
text: "@team, ${{ github.event.pull_request.title }}\n${{ github.event.pull_request.html_url }}"
Follow this guide on how to create a Flowdock App and Bot:
Quick Setup Guide:
- Create a Flowdock application, https://www.flowdock.com/oauth/applications/new
- Check the
Shortcut Application
box. This skips OAuth setup because for the purposes of an automated post, the auth method we want is Source Token Authentication. - Give your app a name and avatar, these will be shown when it posts to the flow.
- Save your Application, job complete.
- Within the Flowdock application, select your target flow, click the three dots to the right of the flow name, and click Integrations.
- Find your Flowdock Developer Application in the list of integrations, click
+ Connect
- You will be shown a Source Token, which you can then copy and store.
- Find your Flowdock Developer Application in the list of integrations, click
- Go to your Github Repo
- Go to "Settings" > "Secrets" for the repo
- Create a new secret called
<YOUR FLOW NAME HERE>_FLOW_ACCESS_TOKEN
with the value from the Source Token.- E.g. if you have a flow called
Pull Requests
your token should bePULL_REQUESTS_FLOW_ACCESS_TOKEN
- E.g. if you have a flow called
- Save, and you're done.
- Go to your github repo
- Go to actions
- Create a new one, you can use the sample above
Since this was made for my team to be able to post Github Pull Requests automatically, we need some github context information. Here is some info that you might care about:
Further reading for Github Context and Syntax here:
Further reading on Webhook events and payloads (Pull Requests)
Syntax | Description |
---|---|
github.event.pull_request.title |
The title of the pull request |
github.event.pull_request.html_url |
The URL that links to the pull request |
github.event.pull_request.user.login |
The username of the person who created the PR |
github.head_ref |
The source branch of the pull request in a workflow run (only available if workflow run is pull_request ) |
github.base_ref |
The target branch of the pull request in a workflow run (only available if workflow run is pull_request ) |
github.repository |
The owner and repository name. |
Look in the package.json
for the commands you can run, there are scripts for prettier, linting, building and testing.
If you are forking this or contributing don't forget to run yarn all
before merging your work.
To run the main test:
env FLOWDOCK_TEST_TOKEN=<YOUR TOKEN> TEXT="Test" yarn ava __tests__/main.test.ts
To debug action and see what payload is being sent to slack, enable debugging: