Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
Last active August 26, 2021 17:51
Show Gist options
  • Save wzulfikar/e9064862d17467ed36b81d2f2c17389a to your computer and use it in GitHub Desktop.
Save wzulfikar/e9064862d17467ed36b81d2f2c17389a to your computer and use it in GitHub Desktop.
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
pipeline:
build:
image: alpine
commands:
- echo "do something :v"
slack:
image: plugins/slack
channel: dev__builds
webhook: https://hooks.slack.com/services/...
# here's the template :)
# notice that the repo endpoint is hardcoded to `https://github.com/`.
# you may adjust it accordingly.
template: >
{{#if build.pull }}
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}*: <https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
{{else}}
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}: Build #{{ build.number }}* (type: `{{ build.event }}`)
{{/if}}
Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
<{{ build.link }}|Visit build page ↗>
@wzulfikar
Copy link
Author

And here's how the template will look like in slack:
screen shot 2018-08-04 at 3 40 03 am

@ivermac
Copy link

ivermac commented Sep 10, 2020

Thanks for this! Got me started with drone and slack integration

@wzulfikar
Copy link
Author

With pleasure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment