-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
# https://github.com/jasonk/inform-slack | ||
|
||
source inform-slack | ||
|
||
shell="" | ||
|
||
while (( $# )); do | ||
case "$1" in | ||
--shell) shell="$2" ; shift 2 ;; | ||
--shell=*) shell="${1#*=}" ; shift 1 ;; | ||
-*) usage "Unknown option '$1'" ;; | ||
*) break ;; | ||
esac | ||
done | ||
|
||
if [ -n "${shell:-}" ]; then | ||
command=( "$shell" "-c" "$@" ) | ||
else | ||
command=( "$@" ) | ||
fi | ||
|
||
printf -v output '```\n%s\n```\n' "$("${command[@]}")" | ||
|
||
block-mrkdwn "$output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# command-output # | ||
|
||
This builder takes a command and it's arguments, runs the command, | ||
captures it's output, and posts the output to Slack as | ||
pre-formatted text. | ||
|
||
## Usage ## | ||
|
||
```sh | ||
inform-slack --attach command-output 'ls -l $WORKSPACE' | ||
``` | ||
|
||
## Options ## | ||
|
||
* `--shell <shell>` or `--shell=<shell>` - Run the command with | ||
a shell, rather than directly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
cd "$(dirname "$0")" | ||
|
||
REPO="https://github.com/jasonk/inform-slack" | ||
|
||
# Executable Version | ||
EV="$(../bin/inform-slack --version)" | ||
# Changelog Info | ||
CI="$(grep -E '^## \[v([0-9\.]+)\]' ../CHANGELOG.md | head -1 | tr -d '\[\]#')" | ||
# Changelog Version | ||
CV="$(awk '{print $1}' <<<"$CI")" | ||
# Changelog Date | ||
CD="$(awk '{print $3}' <<<"$CI")" | ||
# Today's Date | ||
TD="$(date +%F)" | ||
|
||
if git rev-parse -q --verify "refs/tags/$EV" >/dev/null; then | ||
echo "Version $EV already tagged, did you forget to increment it?" | ||
fi | ||
|
||
if [ "$TD" != "$CD" ]; then | ||
echo "Today is $TD, but latest Changelog entry is $CD" | ||
fi | ||
if [ "$CV" != "$EV" ]; then | ||
echo "Executable version is $EV, but Changelog version is $CV" | ||
fi | ||
|
||
UR="$(grep -E '^\[Unreleased\]:' ../CHANGELOG.md)" | ||
if [ -z "$UR" ]; then | ||
echo "No [Unreleased] URL in CHANGELOG" | ||
fi | ||
if [ "$(basename "$UR")" != "${EV}...HEAD" ]; then | ||
echo "Wrong [Unreleased] URL in CHANGELOG" | ||
fi | ||
|
||
if ! grep -qE "^\[$EV\]: $REPO/releases/tag/$EV$" ../CHANGELOG.md; then | ||
echo "No [$EV] tag in CHANGELOG" | ||
fi | ||
|
||
if [ -n "$(git status --porcelain=v1 2>/dev/null)" ]; then | ||
echo "The repo has uncommitted changes" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters