chore: refactor pipelines (#97)

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #97
This commit is contained in:
Marcel_Henselin 2026-03-27 15:23:30 +00:00
parent 2893a11c0a
commit 7b2dfaea44
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
5 changed files with 145 additions and 50 deletions

View file

@ -9,11 +9,17 @@ inputs:
title:
description: "The title of the notification."
required: true
default: 'no title provided'
subtitle:
description: "The subtitle of the notification."
default: 'no subtitle provided'
image_slug:
description: "The slug of the image to be included in the notification."
default: 'git'
event_author:
description: "The author of the event."
required: true
default: 'unknown'
event_title:
@ -22,35 +28,23 @@ inputs:
event_body:
description: "The body of the event."
required: true
default: 'no body provided'
event_number:
description: "The number of the event."
required: true
default: 'no number provided'
event_url:
description: "The url of the event."
required: true
default: 'none'
status:
description: "The status of the event."
default: 'UNKNOWN'
runs:
using: "composite"
steps:
# - name: event list
# shell: bash
# run: |
# cat <<'EOF'
# ${{ toJSON(github) }}
# EOF
#
# - name: print env
# shell: bash
# run: |
# env
# exit 1
- name: Install prerequisites
shell: bash
run: |
@ -60,6 +54,27 @@ runs:
apt install -y curl jq
echo "::endgroup::"
- name: Determine status color
id: status
shell: bash
run: |
case "${{ inputs.status }}" in
SUCCESS)
STATUS_COLOR="006400/228b22"
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "check_circle"}},"text": "<b style=\"color: green;\">SUCCESS</b>"}},'
;;
FAILURE)
STATUS_COLOR="8b0000/dc143c"
ADD='{"decoratedText": {"startIcon": {"materialIcon": {"name": "stop_circle"}},"text": "<b style=\"color: red;\">FAILURE</b>"}},'
;;
*)
STATUS_COLOR="483d8b/6495ed"
ADD=''
;;
esac
echo "color=${STATUS_COLOR}" >> "$GITHUB_OUTPUT"
echo "status_add=${ADD}" >> "$GITHUB_OUTPUT"
- name: Notify via Google Chat Webhook
shell: bash
env:
@ -69,7 +84,8 @@ runs:
PAYLOAD=$(jq -n -r \
--arg header "${{ inputs.title }}" \
--arg repo "${{ github.repository || '' }}" \
--arg subtitle "${{ inputs.subtitle }}" \
--arg imgurl "https://cdn.simpleicons.org/${{ inputs.image_slug }}/${{ steps.status.outputs.color }}" \
--arg title "${{ inputs.event_title || 'no event title given' }}" \
--arg body "${{ inputs.event_body || 'no event body given' }}" \
--arg author "${{ inputs.event_author || 'no event author given' }}" \
@ -77,8 +93,8 @@ runs:
'{ "cardsV2": [ { "cardId": "notify-${{ github.run_id }}", "card": {
"header": {
"title": "\($header)",
"subtitle": "Repo: \($repo)",
"imageUrl": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/git.png",
"subtitle": "\($subtitle)",
"imageUrl": "\($imgurl)",
"imageType": "SQUARE"
},
"sections": [
@ -86,12 +102,13 @@ runs:
"header": "\($title)",
"collapsible": false,
"widgets": [
${{ steps.status.outputs.status_add }}
{
"decoratedText": {
"icon": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<b>Opened by:</b> \($author)"
"text": "<b>\($author)</b>"
}
},
{