Skip to content

Commit

Permalink
fix(validate_pr.yml): use $GITHUB_OUTPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
duncdrum committed Dec 12, 2023
1 parent 2e8e00b commit d18bbb1
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
steps:
# checkout code
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: project
fetch-depth: 2
# checkout schema as xmllint can't https
- name: Checkout schema repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: BetaMasaheft/Schema
path: schema
Expand All @@ -30,26 +30,39 @@ jobs:
- name: Check for changed source files
id: changed
run: |
echo "::set-output name=files::$( \
git diff --name-only --diff-filter=ACMRT \
{
echo "FILES=$(git diff --name-only --diff-filter=ACMRT \
${{ github.event.pull_request.base.sha }} \
${{ github.sha }} -- ':./**/*.xml' ':!./**/transkribus*.xml' ':!./**/facsimile*.xml' | xargs)"
${{ github.sha }} \
-- ':./**/*.xml' ':!*/transkribus*.xml' ':!*/facsimile*.xml' \
':!./**/edition.xml' ':!./**/msDesc.xml' ':!./**/*text.xml' \
':!./**/taxonomy.xml' ':*.xml' ':!build.xml' ':!expath-pkg.xml' ':!repo.xml' | xargs)"
} >> "$GITHUB_OUTPUT"
# If no xml files were modified ...
- name: No source files changed
if: ${{ steps.changed.outputs.FILES == '' }}
run: |
echo "All good"
# ... otherwise
- name: List modified documents
env:
FILES: ${{ steps.changed.outputs.FILES }}
if: ${{ steps.changed.outputs.FILES != '' }}
run: |
echo "modified: $FILES"
# Validate changed files against latest schema
- name: Validate changed source files
if: ${{ steps.changed.outputs.files != '' }}
env:
FILES: ${{ steps.changed.outputs.FILES }}
if: ${{ steps.changed.outputs.FILES != '' }}
run: |
xmllint \
--noout --xinclude --nowarning \
--relaxng ../schema/tei-betamesaheft.rng \
${{ steps.changed.outputs.files }} \
$FILES \
2>&1 | \
{ grep -vE 'RNG|validates' || :; }
# If no xml files were modified
- name: No source files changed
if: ${{ steps.changed.outputs.files == '' }}
run: |
echo "All good"
# ensure branch conaints only well-formed xml files
# ensure branch contains only well-formed xml files
- name: Ensure all XML files are well formed
run: |
xmllint --noout \
Expand Down

0 comments on commit d18bbb1

Please sign in to comment.