Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp: Auto update examples index #956

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

charlieegan3
Copy link
Member

@charlieegan3 charlieegan3 commented Aug 1, 2024

As pages are added to docs.styra.com/opa/rego-by-example, this json file will be updated meaning more keywords and builtins will be linked in the Regal hover messages.

@charlieegan3 charlieegan3 marked this pull request as draft August 1, 2024 10:59
@charlieegan3 charlieegan3 force-pushed the update-examples branch 18 times, most recently from 5ac2e32 to 1b23fa2 Compare August 1, 2024 12:55
"contains": "keywords/contains",
"some": "keywords/some"
}
"builtins": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes here will be updated when the workflow is manually run on main, or on schedule.

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor remarks, but looks good!


- name: Install xq (part of yq)
run: |
pip install yq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already depend on rq for builds, and AFAIK rq can do xml -> json too. So perhaps we should use that here instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

➜ cat p.xml | rq -i xml --indent "  "
{
  "root": {
    "p": {
      "a": "1",
      "b": "2",
      "c": "3"
    }
  }
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! Have fixed this now to use rq and the cached binary too.

-d build/workflows/update-example-index/process.rego \
--format=raw \
--stdin-input \
| jq \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I have replaced with --format=pretty


name := p[1]

not count({p |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not count looks fishy... even if it's the > being negated. < 2 instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that doesn't look good... I have fixed to your version now.

@charlieegan3 charlieegan3 force-pushed the update-examples branch 5 times, most recently from 10da4e1 to 3afbf76 Compare August 5, 2024 14:19
@charlieegan3
Copy link
Member Author

Think all addressed here now so going to merge for a final test on main.

@charlieegan3 charlieegan3 merged commit dfe21e6 into StyraInc:main Aug 5, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants