Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/auto-build-artifacts.yaml
Copy link
Contributor

@eecavanna eecavanna Sep 16, 2025

Choose a reason for hiding this comment

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

I recommend ensuring tests pass before regenerating the artifacts. That could be accomplished by invoking a different workflow, as long as that other workflow has:

  # Allow this workflow to be called by other workflows.
  # Reference: https://docs.github.com/en/actions/using-workflows/reusing-workflows
  workflow_call: { }

...or by running the tests directly in this workflow.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Auto-build artifacts on schema update

on:
push:
branches:
- main
- develop
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know that there are any existing conventions in this repo for a branch named develop. I recommend removing this line.

paths:
- 'src/schema/linkml/**'
pull_request:
paths:
- 'src/schema/linkml/**'

jobs:
build-artifacts:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip artifacts]') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment saying that [skip artifacts] is being included here to avoid infinite loops. That is explained in the PR description, but not here in the file.


steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
Comment on lines +27 to +29
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The actions/setup-python action version should be updated to v5 for better compatibility and features. Also, the Python version should be quoted to avoid potential YAML parsing issues.

Suggested change
uses: actions/setup-python@v4
with:
python-version: 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

As commented here (#73 (comment)), this step as a whole can be removed.


- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
uv sync
Comment on lines +26 to +36
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. "Set up Python 3.12" is unnecessary. "Install dependencies" (via uv sync) will take care of installing Python.
  2. Regarding astral-sh/setup-uv@v3: v6 is available now


- name: Generate artifacts
run: |
make gen-artefacts
Copy link

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

[nitpick] The target name 'gen-artefacts' uses British spelling. Consider using 'gen-artifacts' for consistency with American English conventions typically used in software development.

Suggested change
make gen-artefacts
make gen-artifacts

Copilot uses AI. Check for mistakes.

- name: Check for changes
id: check_changes
run: |
git add src/schema/jsonschema/ src/schema/datamodel/
if git diff --staged --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi

- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true' && github.event_name == 'push'
Comment on lines +42 to +53
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment explaining how this "check for changes" + "check the results of that check" works.

run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Auto-generate artifacts from schema update [skip artifacts]"
git push
Comment on lines +52 to +58
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to point out that this will make an additional commit to the repository.


- name: Add PR comment for artifact changes
if: steps.check_changes.outputs.changes == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🤖 **Artifacts will be auto-generated** when this PR is merged due to schema changes in `src/schema/linkml/`.'
})