Files
gitea-ci-library/.gitea/workflows/config-provider.yml
T
moilanik 607a0f6360
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 9s
CI Feature / Validate CI config (push) Failing after 16s
ci-bats Bats tests OK
CI Feature / Bats tests (push) Successful in 1m40s
ci-cucumber Cucumber tests OK
CI Feature / Cucumber tests (push) Successful in 1m3s
CI Feature / Report Summary (push) Successful in 5s
refaktorointia
2026-06-15 16:49:44 +03:00

38 lines
1013 B
YAML

name: Config Provider Library
on:
workflow_call:
inputs:
config_path:
required: true
type: string
outputs:
env_json:
value: ${{ jobs.parse-config.outputs.json_data }}
config_path:
value: ${{ jobs.parse-config.outputs.config_path }}
jobs:
parse-config:
runs-on: ubuntu-latest
outputs:
json_data: ${{ steps.convert.outputs.JSON_OUT }}
config_path: ${{ steps.set-path.outputs.CONFIG_PATH }}
steps:
- uses: actions/checkout@v4
- id: convert
run: |
JSON_STRING=$(jq -R -s '
split("\n")
| map(select(length > 0 and (startswith("#") | not)))
| map(split("="))
| map({(.[0]): .[1]})
| add
' "${{ inputs.config_path }}")
CLEAN_JSON=$(echo "$JSON_STRING" | jq -c .)
echo "JSON_OUT=$CLEAN_JSON" >> "$GITHUB_OUTPUT"
- id: set-path
run: echo "CONFIG_PATH=${{ inputs.config_path }}" >> "$GITHUB_OUTPUT"