Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bowtie-json-schema/github-actions-example
A test repository for demonstrating the use of Bowtie via GitHub Actions
https://github.com/bowtie-json-schema/github-actions-example
Last synced: 18 days ago
JSON representation
A test repository for demonstrating the use of Bowtie via GitHub Actions
- Host: GitHub
- URL: https://github.com/bowtie-json-schema/github-actions-example
- Owner: bowtie-json-schema
- Created: 2023-06-17T05:58:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-19T13:20:57.000Z (over 1 year ago)
- Last Synced: 2024-11-07T02:19:23.239Z (2 months ago)
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bowtie-actions-example
A test repository for documenting bowtie in GitHub Actions.## Documentation outline
---- Setup bowtie
- Initial Steps
- Verification Steps
- Validate using bowtie
- Add the `validate` Command
- Change the Dialect
- Use Multiple Implementations
### Setup bowtie
---#### 1. **Initial Steps**
- Create `.github/workflows' directory in your repository.
- Create a file with `.yml` extension.
- Enter the following code in the YAML file:```yaml
name: Setup Bowtie
run-name: ${{ github.actor }} is learning to use Bowtieon: [push]
jobs:
sets-up-bowtie:
runs-on: ubuntu-lateststeps:
- name: Install Bowtie
uses: bowtie-json-schema/[email protected]
```_This will install bowtie every time you push onto the repository._
#### 2. **Verification Steps**
- Append the following code in the already created YAML file:
```yaml
- name: Run Bowtie
run: bowtie --version
```- The YAML file will look something like this:
```yaml
name: Setup Bowtie
run-name: ${{ github.actor }} is learning to use Bowtieon: [push]
jobs:
sets-up-bowtie:
runs-on: ubuntu-lateststeps:
- name: Install Bowtie
uses: bowtie-json-schema/[email protected]- name: Run Bowtie
run: bowtie --version
```- Push the changes to your repository.
- Go to the `Actions` tab of your repository and wait for the action to complete.
- If the run was successful, you will see a green circle with a tick.
- Click on the Workflow and then click on the ` sets-up-bowtie` Job.
- Open the drop down of the `Run Bowtie` step.
- If it shows something like this, bowtie is running successfully:
```bash
bowtie, version 2023.6.4
```> IF THE RUN WAS NOT SUCCESSFUL, YOU WILL SEE A RED CIRCLE WITH A CROSS. RECHECK THE CODE YOU HAVE WRITTEN, AND CORRECT IN CASE OF ANY DISCREPANCY.
_This will help us to test if bowtie is working in the GitHub action._
### Validate using bowtie
---Now that you have successfully added bowtie to your workflow, let's work on using it to validate your JSON Specifications.
#### 1. **Add the `validate` Command**
- Add the following code snippet to your YAML file:
```yaml
- name: Validate Schema
run: bowtie validate -i lua-jsonschema schema.json instance.json
```
Let's break down this command:- `bowtie validate`: It tells which command to run.
- `-i`: It is a required flag for `validate` command and specifies which implementation to be used, which in this case is `lua-jsonschema`.
- `schema.json`: It is the name of the file containing the defined schema against which instances will be validated.
- `instance.json`: It is the name of the file containing the instances to be validated._You will see that the implementation is skipped and thus does not validate the instances. This is because the lua implementation does not support the default 2020-12 draft._
#### 2. **Change the Dialect**
- To change the dialect used by the implementation, change the validate command to this:
```yaml
- name: Validate Schema
run: bowtie validate -i lua-jsonschema --dialect 7 schema.json instance.json
```
_This will change the dialect used to draft 7 instead of the default 2020-12._#### 3. **Use Multiple Implementations**
- You might require using two or more different implementations for the same schema and instances. This is how you can get it done:
```yaml
- name: Validate Schema
run: bowtie validate -i lua-jsonschema -i python-jsonschema schema.json instance.json
```
_Here we have used just two implementations, namely: python and lua. You may make changes according to your requirements._
_Note that you cannot use different dialects for different implementations in the same command, bowtie just takes the last dialect specified by using the `--dialect` flag._