Skip to content

Green text

Green text #258

Workflow file for this run

name: Lint and validate
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- "main"
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get all theme files that have changed
id: changed-files
uses: tj-actions/changed-files@v37
with:
separator: "\n"
files_yaml: |
theme:
- themes/**/*.json
schema:
- schemas/*.json
- name: Validate JSON
if: steps.changed-files.outputs.theme_any_changed == 'true' || steps.changed-files.outputs.schema_any_changed == 'true'
uses: GrantBirki/json-yaml-validate@v2.2.0
with:
comment: "true"
use_dot_match: "false"
json_schema: ./schemas/v1.schema.json
files: ${{ steps.changed-files.outputs.theme_all_changed_files }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run custom validations
uses: actions/github-script@v6
id: custom-validations
if: steps.changed-files.outputs.theme_any_changed == 'true'
with:
script: |
const script = require('./.github/workflows/scripts/validate-pr.js')
return await script({
github,
context,
files: `${{ steps.changed-files.outputs.theme_all_changed_and_modified_files }}`
});
- name: Create preview comment
uses: actions/github-script@v6
if: steps.changed-files.outputs.theme_any_changed == 'true' && steps.custom-validations.outputs.result == 'true'
with:
script: |
const script = require('./.github/workflows/scripts/create-comment.js')
await script({
github,
context,
id: "preview-comment",
body: `Your preview URL is: https://theme-builder.notesnook.com/notes?from_pr=streetwriters/notesnook-themes/${context.issue.number}`
});