-
Notifications
You must be signed in to change notification settings - Fork 3
Implement summary and tag validation logic #16
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
Open
imyeyun
wants to merge
2
commits into
PyTorchKorea:main
Choose a base branch
from
imyeyun:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,035
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: LLM Metadata Validation | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "data/**" | ||
| - "scripts/validate_llm_metadata.py" | ||
| - "tests/test_validate_llm_metadata.py" | ||
| - ".github/workflows/llm-metadata-validation.yml" | ||
| schedule: | ||
| - cron: "0 2 * * 1" | ||
| workflow_dispatch: | ||
| inputs: | ||
| mode: | ||
| description: "Validation mode" | ||
| required: false | ||
| default: "report" | ||
| type: choice | ||
| options: | ||
| - report | ||
| - strict | ||
|
|
||
| jobs: | ||
| validate-llm-metadata: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| VALIDATION_MODE: ${{ inputs.mode || 'report' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: pip | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install -r requirements.txt | ||
|
|
||
| - name: Detect newly added entry IDs | ||
| id: changed-ids | ||
| if: github.event_name == 'pull_request' | ||
| run: | | ||
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | ||
| HEAD_SHA="${{ github.event.pull_request.head.sha }}" | ||
| ADDED_IDS="$(git diff --unified=0 "${BASE_SHA}" "${HEAD_SHA}" -- data/models.yaml data/datasets.yaml data/tools.yaml \ | ||
| | rg '^\+\s*id:\s*' -o -r '$0' \ | ||
| | sed -E 's/^\+\s*id:\s*//' \ | ||
| | tr -d '"' \ | ||
| | tr '\n' ',' \ | ||
| | sed 's/,$//')" | ||
| echo "entry_ids=${ADDED_IDS}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Skip when no new metadata entries | ||
| if: github.event_name == 'pull_request' && steps.changed-ids.outputs.entry_ids == '' | ||
| run: | | ||
| mkdir -p reports | ||
| cat <<'EOF' > reports/llm_validation_report.json | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EOF 앞뒤에 따옴표가 붙으면 뒤에 이어지는 코드에서 변수 치환이 제대로 되지 않는 것으로 보여, 확인 부탁드립니다. |
||
| {"mode":"${VALIDATION_MODE}","status":"skipped","skipped_reason":"No newly added metadata entries in this PR.","counts":{"pass":0,"warning":0,"fail":0},"results":[]} | ||
| EOF | ||
| cat <<'EOF' > reports/llm_validation_summary.md | ||
| # LLM Metadata Validation | ||
| - Mode: `${VALIDATION_MODE}` | ||
| - Status: `skipped` | ||
| - Pass: `0` | ||
| - Warning: `0` | ||
| - Fail: `0` | ||
| - Skipped reason: No newly added metadata entries in this PR. | ||
| EOF | ||
|
|
||
| - name: Run LLM metadata validation | ||
| if: github.event_name != 'pull_request' || steps.changed-ids.outputs.entry_ids != '' | ||
| run: > | ||
| python scripts/validate_llm_metadata.py | ||
| --mode "${VALIDATION_MODE}" | ||
| --entry-ids "${{ steps.changed-ids.outputs.entry_ids }}" | ||
| --output reports/llm_validation_report.json | ||
| --summary-output reports/llm_validation_summary.md | ||
|
|
||
| - name: Publish Actions summary | ||
| if: always() | ||
| run: cat reports/llm_validation_summary.md >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Upload validation report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: llm-validation-report | ||
| path: | | ||
| reports/llm_validation_report.json | ||
| reports/llm_validation_summary.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,3 +19,4 @@ env/ | |
|
|
||
| # Generated (docs/data.js is a build artifact from generate_site.py) | ||
| docs/data.js | ||
| reports/ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 옵션을 사용하는 게 어떤 의미인지 알 수 있을까요? 각 옵션별로 어떻게 동작하는지 궁금합니다.