Skip to content

lsp: Auto update examples index #1

lsp: Auto update examples index

lsp: Auto update examples index #1

# this workflow is used to update the internal/lsp/examples/index.json
# file containing an index of the content available on
# http://docs.styra.com/opa/rego-by-example
name: Update Examples Index
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *' # Run daily at 1 AM UTC
pull_request:
jobs:
update-examples-index:
name: Update Examples Index
runs-on: ubuntu-22.04
permissions:
contents: write # this workflow updates repo contents
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Fetch and save index to temporary directory
run: |
TEMP_DIR=$(mktemp -d)
curl -L https://docs.styra.com/sitemap.xml | xq . - > "$TEMP_DIR/output.json"
cat "$TEMP_DIR/output.json" | \
opa eval 'data.process.symbols' \
-d build/workflows/update-examples-index/process.rego \
--format=raw \
--stdin-input \
| tee internal/lsp/examples/index.json
# - name: Commit and push changes
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: Update Imported Docs