cortex-rules-action
cortex-rules-action copied to clipboard
fix: multiline output
Hey folks 👋
Small PR that fix/simplify the way the multiline is rendered in the output of the action
With the following pipeline
name: loki_rules_ci
on:
workflow_dispatch:
pull_request:
jobs:
loki_rules:
name: Check Loki Rules
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check Loki rules
uses: rasta-rocket/cortex-rules-action@fix_multiline
env:
CORTEX_ADDRESS: "xxxxxx"
CORTEX_TENANT_ID: xxxxx
BACKEND: loki
ACTION: check
RULES_DIR: "./loki/alert,./loki/record"
- name: Diff Loki rules
id: diff_rules
uses: rasta-rocket/cortex-rules-action@fix_multiline
env:
CORTEX_ADDRESS: "xxxxxxx"
CORTEX_TENANT_ID: xxxxx
BACKEND: loki
ACTION: diff
RULES_DIR: "./loki/alert,./loki/record"
- name: Put diff in summary
run: |
echo "${{ steps.diff_rules.outputs.detailed }}"
echo '# Diff summary' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "${{ steps.diff_rules.outputs.detailed }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
Before the fix:
After the fix:
This has been done following :
- https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
- https://til.juliusgamanyi.com/posts/gh-actions-save-multiline-string-in-output-var/
Don't hesitate to ping me if any remarks/questions 😉 ?
Cheers ☀️
A couple of requests, please:
- Could you provide an example that shows the issue you're fixing, please?
- Can you check the CI linter failure, please?
@pracucci thx for the first review 😉
- I updated the main description of the PR with screenshot
- I fixed the linting according the CI recommendation
@pracucci 👋 did you had a chance to review my last changes ?
LGTM, thank you.