chore: Add tofu workflows #1
1 changed files with 20 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
name: tofu plan k8s-wheatley
|
name: Tofu Plan k8s-wheatley
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
@ -53,7 +53,7 @@ jobs:
|
||||||
run: tofu plan -no-color
|
run: tofu plan -no-color
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Fetch existing comments
|
- name: Fetch existing comment ID
|
||||||
id: fetch
|
id: fetch
|
||||||
run: |
|
run: |
|
||||||
response=$(curl -s \
|
response=$(curl -s \
|
||||||
|
|
@ -61,7 +61,7 @@ jobs:
|
||||||
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
|
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
|
||||||
|
|
||||||
comment_id=$(echo "$response" | jq -r \
|
comment_id=$(echo "$response" | jq -r \
|
||||||
'.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
|
'.[] | select(.body | test("${{ forge.workflow }}")) | .id' | head -n 1)
|
||||||
|
|
||||||
echo "comment_id=$comment_id"
|
echo "comment_id=$comment_id"
|
||||||
|
|
||||||
|
|
@ -69,9 +69,12 @@ jobs:
|
||||||
id: comment
|
id: comment
|
||||||
env:
|
env:
|
||||||
COMMENT_BODY: |
|
COMMENT_BODY: |
|
||||||
#### OpenTofu Format and Style 🖌`${{ steps.fmt.outcome }}`
|
### ${{ forge.workflow }}
|
||||||
#### OpenTofu Initialization ⚙️`${{ steps.init.outcome }}`
|
|
||||||
#### OpenTofu Validation 🤖`${{ steps.validate.outcome }}`
|
${FMT_EMOJI} OpenTofu Format and Style `${{ steps.fmt.outcome }}`
|
||||||
|
${INIT_EMOJI} OpenTofu Initialization `${{ steps.init.outcome }}`
|
||||||
|
${VALIDATE_EMOJI} OpenTofu Validation `${{ steps.validate.outcome }}`
|
||||||
|
|
||||||
<details><summary>Validation Output</summary>
|
<details><summary>Validation Output</summary>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -90,6 +93,17 @@ jobs:
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
emoji() {
|
||||||
|
[ "$1" = "success" ] && echo "✅" || echo "❌"
|
||||||
|
}
|
||||||
|
|
||||||
|
export FMT_EMOJI=$(emoji "$FMT_STATUS")
|
||||||
|
export INIT_EMOJI=$(emoji "$INIT_STATUS")
|
||||||
|
export VALIDATE_EMOJI=$(emoji "$VALIDATE_STATUS")
|
||||||
|
export PLAN_EMOJI=$(emoji "$PLAN_STATUS")
|
||||||
|
|
||||||
payload=$(jq -Rs --arg body "$COMMENT_BODY" '{body: $body}' <<< "$COMMENT_BODY")
|
payload=$(jq -Rs --arg body "$COMMENT_BODY" '{body: $body}' <<< "$COMMENT_BODY")
|
||||||
|
|
||||||
if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then
|
if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue