Skip to content

Commit

Permalink
fix: release notes slack tweaks (#1161)
Browse files Browse the repository at this point in the history
* Tweaks for sending via slack correctly

* remove unused code
  • Loading branch information
Sloox authored Sep 25, 2020
1 parent 82eefc8 commit ac83e87
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 2 additions & 0 deletions flank-actions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN chmod +x /compile.sh

RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && /compile.sh"

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

RUN chmod +x /sendMessage
Expand Down
6 changes: 4 additions & 2 deletions flank-actions/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

echo 'Sending message'
./sendMessage $INPUT_XOXCTOKEN $INPUT_MESSAGE $INPUT_CHANNEL $INPUT_COOKIE
echo 'Attempting to sendMessage'
cd /
./sendMessage "$INPUT_XOXCTOKEN" "$INPUT_CHANNEL" "$INPUT_MESSAGE" "$INPUT_COOKIE"

echo 'Sending message done!'
12 changes: 1 addition & 11 deletions flank-actions/slackService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@ fun sendMessage(args: Array<String>): Int{
val token = args[Common.ARGS_TOKEN]
val channel = args[Common.ARGS_CHANNEL]
val message = args[Common.ARGS_MESSAGE]
val cookie = args.copyOfRange(Common.ARGS_COOKIE, args.lastIndex).joinToString(" ")
val cookie = args[Common.ARGS_COOKIE]

return try {
val (req, rep, res) = Fuel.get(Common.URL_SLACK,
listOf("token" to token,"channel" to channel,"text" to message))
.header(Headers.COOKIE to cookie)
.responseString()

debug("Result: $res")
Common.EXIT_CODE_SUCCESS
}
catch(e: Exception) {
error("Error has occured: $e")
Common.EXIT_CODE_FAILURE
}
}

fun debug(message: String){
println("::debug::$message")
}

fun error(message: String) {
println("::error::$message")
}

0 comments on commit ac83e87

Please sign in to comment.