Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]

repository_dispatch:
types: [values-generated]
jobs:
build:
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/values_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
--values "helm-charts/charts/crowdsec/values.yaml" \
--readme "crowdsec-docs/docs/configuration/values_parameters.md" \
--schema "/tmp/schema.json"

./scripts/anchor.awk ./crowdsec-docs/docs/configuration/values_parameters.md > /tmp/values_parameters.md
mv /tmp/values_parameters.md ./crowdsec-docs/docs/configuration/values_parameters.md
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
Expand All @@ -52,3 +53,10 @@ jobs:
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash

- name: Trigger downstream
if: steps.cpr.outputs.pull-request-number != ''
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ github.token }}
event-type: values-generated
21 changes: 21 additions & 0 deletions scripts/anchor.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/awk -f

/^\|/ && /`[^`]+`/ {
# Find the first backticked token: `...`
if (match($0, /`[^`]+`/)) {
token = substr($0, RSTART, RLENGTH) # includes backticks
key = token
gsub(/`/, "", key) # remove backticks -> image.pullSecrets

id = key
# lowercase (portable-ish: works in most modern awks; if not, see note below)
id = tolower(id)
gsub(/\./, "-", id) # dots -> dashes

anchor = token "<a id=\"" id "\"></a>"
sub(token, anchor) # replace first token only
}
}

{ print }

Loading