fix: fix iconslug handling
All checks were successful
Sample Testing / my_job (push) Successful in 2m58s
All checks were successful
Sample Testing / my_job (push) Successful in 2m58s
This commit is contained in:
parent
5417352afc
commit
f4b486b99b
3 changed files with 15 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
name: 'Google Chat Action'
|
name: 'Google Chat Action'
|
||||||
author: 'D Ther Htun'
|
author: 'D Ther Htun/ Marcel S. Henselin'
|
||||||
description: 'Github actions for google chat Room Bot'
|
description: 'Github actions for google chat Room Bot'
|
||||||
branding:
|
branding:
|
||||||
icon: 'at-sign'
|
icon: 'at-sign'
|
||||||
|
|
@ -26,13 +26,6 @@ inputs:
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
# using: 'composite'
|
|
||||||
# steps:
|
|
||||||
# - name: 'Run Google Chat Action'
|
|
||||||
# shell: bash
|
|
||||||
# run: |
|
|
||||||
# docker run --rm -it $(docker build -q .)
|
|
||||||
|
|
||||||
#image: 'docker://dther/google-chat-action:v0.8'
|
#image: 'docker://dther/google-chat-action:v0.8'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
args:
|
args:
|
||||||
|
|
|
||||||
13
main.go
13
main.go
|
|
@ -23,6 +23,7 @@ var message string
|
||||||
|
|
||||||
type templateData struct {
|
type templateData struct {
|
||||||
CardID string
|
CardID string
|
||||||
|
IconSlug string
|
||||||
Title string
|
Title string
|
||||||
SubTitle string
|
SubTitle string
|
||||||
Author string
|
Author string
|
||||||
|
|
@ -50,6 +51,13 @@ func main() {
|
||||||
}
|
}
|
||||||
data.Author = author
|
data.Author = author
|
||||||
|
|
||||||
|
icon := githubactions.GetInput("iconslug")
|
||||||
|
if icon == "" {
|
||||||
|
githubactions.Infof("[INFO] Missing input 'iconslug', using default")
|
||||||
|
icon = "git"
|
||||||
|
}
|
||||||
|
data.IconSlug = icon
|
||||||
|
|
||||||
title := githubactions.GetInput("title")
|
title := githubactions.GetInput("title")
|
||||||
if title == "" {
|
if title == "" {
|
||||||
githubactions.Infof("[INFO] Missing input 'title', using default")
|
githubactions.Infof("[INFO] Missing input 'title', using default")
|
||||||
|
|
@ -168,6 +176,11 @@ func card(d templateData) ([]byte, error) {
|
||||||
|
|
||||||
if d.IconUrl == "" {
|
if d.IconUrl == "" {
|
||||||
d.IconUrl = "https://github.githubassets.com/images/modules/logos_page/Octocat.png"
|
d.IconUrl = "https://github.githubassets.com/images/modules/logos_page/Octocat.png"
|
||||||
|
d.IconUrl = fmt.Sprintf(
|
||||||
|
"https://cdn.simpleicons.org/%s/%s",
|
||||||
|
d.IconSlug,
|
||||||
|
d.Color,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.EventBody == "" {
|
if d.EventBody == "" {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"sections": [
|
"sections": [
|
||||||
{
|
{
|
||||||
"header": "{{ .Title }}",
|
"header": "{{ .Title }}",
|
||||||
"collapsible": true,
|
"collapsible": false,
|
||||||
"uncollapsibleWidgetsCount": 2,
|
"uncollapsibleWidgetsCount": 2,
|
||||||
"widgets": [
|
"widgets": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue