Skip to content

Commit 2a4dbf1

Browse files
authored
feat: rewrite to support message customization (#2)
1 parent 1a93f2e commit 2a4dbf1

31 files changed

+1414
-23594
lines changed
File renamed without changes.

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
. "$(dirname -- "$0")/common.sh"
33
. "$(dirname -- "$0")/_/husky.sh"
44

5-
pnpm run pretty-quick
5+
pnpm exec lint-staged

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Richard Harrah
3+
Copyright (c) 2023 SingleStone Consulting
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Changesets Publish Slack Action
1+
# Commit Deploy Slack Action
22

33
GitHub Action to publish messages to a Slack webhook after publishing packages with [Changesets].
44

@@ -19,33 +19,28 @@ jobs:
1919
name: Release
2020
runs-on: ubuntu-latest
2121
steps:
22-
- name: Checkout Repo
23-
uses: actions/checkout@v3
24-
25-
- name: Setup Node.js 16.x
26-
uses: actions/setup-node@v3
27-
with:
28-
node-version: 16.x
29-
30-
- name: Install Dependencies
31-
run: yarn
32-
33-
- name: Create Release Pull Request or Publish to npm
34-
id: changesets
35-
uses: changesets/action@v1
36-
with:
37-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
38-
publish: yarn release
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42-
43-
- name: Send a Slack notification if a publish happens
44-
uses: ToppleTheNun/changesets-slack-publish-action@v1
45-
if: steps.changesets.outputs.published == 'true'
22+
- name: Send a Slack notification
4623
with:
47-
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
4824
slackWebhook: ${{ secrets.SLACK_WEBHOOK }}
4925
```
5026
51-
[Changesets]: https://github.com/changesets/changesets
27+
## Message Customization
28+
29+
By default, a message like the below will be used. You can override this by providing a `message` configuration value.
30+
We use [squirrelly](https://squirrelly.js.org/) as the templating engine with `[[` and `]]` as delimiters.
31+
32+
![A new version of singlestone/team-insights-ui has been deployed!](./img/message.png)
33+
34+
### Helpers
35+
36+
- `@linkify`: Helps with building links to things. Example: `@linkify('https://google.com')`
37+
- Input:
38+
- `url`: **mandatory** - obviously the URL you want to link to :)
39+
- `text`: **optional** - what text you want to show instead of just the link text
40+
41+
### Supported placeholders
42+
43+
- `it.github.*`: You can get everything off of the regular GitHub context provided to GitHub actions.
44+
- `it.repository`: The shorthand name for the repo (e.g., `singlestone/commit-deploy-slack-action`)
45+
- `it.links.commitSha`: Link to the commit that triggered this action.
46+
- `it.links.repository`: Link to the repository that triggered this action.

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ inputs:
1313
message:
1414
description: "Message to be additionally published to Slack"
1515
required: false
16+
default: ":rocket: A new [[@linkify(it.links.commitSha, 'version') /]] of [[@linkify(it.links.repository, it.repository) /]] has been deployed!"
1617
slackWebhook:
1718
description: "Slack webhook to which notifications will be sent."
1819
required: true

0 commit comments

Comments
 (0)