Skip to content

Fix Stripe Calling validation rules #247

Fix Stripe Calling validation rules

Fix Stripe Calling validation rules #247

name: Make JSON-LD
on:
pull_request:
branches: 'main'
paths: 'HTAN.model.csv'
workflow_dispatch:
concurrency:
# cancel the current running workflow from the same branch, PR when a new workflow is triggered
# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group
# {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows
# {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag
# {{ github.sha }}: full commit sha
# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml
group: >-
${{ github.workflow }}-${{ github.ref_type }}-${{ github.sha }}
cancel-in-progress: true
env:
SCHEMATIC_VERSION: '24.2.1'
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
jobs:
lint:
name: Lint CSV
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: csvlinter
uses: kcheriyath/[email protected]
with:
find_pattern: "*.csv"
validate:
name: Validate CSV
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install IPython
run: |
pip install ipython==8.18.1
- name: Install Schematic
run: |
pip install schematicpy==$SCHEMATIC_VERSION
- name: Convert CSV schema
run: |
schematic schema convert .github/CSV.model.csv
- name: Validate data model CSV
run: |
schematic model -c .github/CSV_schematic_config.yml validate -mp HTAN.model.csv -dt "DataModel" |
grep "Your manifest has been validated successfully. There are no errors in your manifest, and it can be submitted without any modifications."
convert:
name: Convert CSV to JSON-LD
needs:
- lint
- validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install IPython
run: |
pip install ipython==8.18.1
- name: Install Schematic
run: |
pip install schematicpy==$SCHEMATIC_VERSION
- name: Convert .csv to .jsonld
run: |
schematic schema convert HTAN.model.csv
- name: Set up Git user
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Fetch PR details
if: github.event_name == 'pull_request'
uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Commit the changes
run: |
# Specifying the full email allows the avatar to show up: https://github.com/orgs/community/discussions/26560
git add HTAN.model.jsonld
git commit -m "GitHub Action: convert *.model.csv to *.model.jsonld" || echo "No changes to commit"
- name: Push changes back to PR
if: github.event_name == 'pull_request'
uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}