Skip to content

Validate wksemergencyinfo-202512251932 #456

Validate wksemergencyinfo-202512251932

Validate wksemergencyinfo-202512251932 #456

Workflow file for this run

name: Validate
run-name: "Validate ${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }}"
on:
workflow_run:
workflows: [Dispatch]
types: [completed]
permissions:
actions: read
statuses: write
pull-requests: write
issues: write
discussions: write
contents: write
checks: write
concurrency:
group: ${{github.workflow}}-${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }}
cancel-in-progress: true
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Register Check
uses: myrotvorets/[email protected]
with:
context: Validate Schemas
sha: ${{ github.event.workflow_run.head_sha }}
status: pending
- name: Download Payload
uses: actions/download-artifact@v7
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
name: payload
- name: Get Payload Info
id: payload
run: |
PAYLOAD=$(cat payload.json)
echo "event=$(echo $PAYLOAD | jq -r '.event')" >> $GITHUB_OUTPUT
echo "actor=$(echo $PAYLOAD | jq -r '.actor')" >> $GITHUB_OUTPUT
echo "head_ref=$(echo $PAYLOAD | jq -r '.head_ref')" >> $GITHUB_OUTPUT
echo "base_ref=$(echo $PAYLOAD | jq -r '.base_ref')" >> $GITHUB_OUTPUT
- name: Get PR Number
if: steps.payload.outputs.event == 'pr'
uses: actions/github-script@v7
id: pr_number
with:
script: |
const head_sha = "${{ github.event.workflow_run.head_sha }}";
console.log("Finding PR for SHA:", head_sha);
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
const pr = prs.find(pr => pr.head.sha === head_sha);
if (pr) {
console.log("Found PR:", pr.number);
return pr.number;
} else {
core.setFailed("PR not found");
}
- name: Print Dispatch Info
run: |
echo "Actor: ${{ steps.payload.outputs.actor }}"
echo "PR Number: ${{ steps.pr_number.outputs.result || 'N/A' }}"
echo "Head Ref: ${{ steps.payload.outputs.head_ref }}"
echo "Head Sha: ${{ github.event.workflow_run.head_sha }}"
echo "Base Ref: ${{ steps.payload.outputs.base_ref }}"
- name: Checkout Head (${{ steps.payload.outputs.head_ref }})
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
persist-credentials: false
path: pr
- name: Checkout Base (${{ steps.payload.outputs.base_ref }})
uses: actions/checkout@v4
with:
ref: ${{ steps.payload.outputs.base_ref }}
persist-credentials: false
path: base
- name: Download EXDTools
uses: robinraju/release-downloader@v1
with:
repository: xivdev/EXDTools
fileName: "EXDTooler"
latest: true
- name: Chmod Executable
run: chmod +x EXDTooler
- name: Run Validation
id: validation
run: |
./EXDTooler --gha --debug --verbose validate -c base/.github/columns.yml -s pr -b base
- name: Write out summary
if: always()
env:
SUMMARY_CONTENT: ${{steps.validation.outputs.summary}}
run: |
echo "$SUMMARY_CONTENT" > summary.txt
cat summary.txt >> $GITHUB_STEP_SUMMARY
- uses: myrotvorets/[email protected]
if: always()
with:
sha: ${{ github.event.workflow_run.head_sha }}
context: Validate Schemas
status: ${{job.status}}
- name: Wipe previous comments (PR)
if: always() && steps.payload.outputs.event == 'pr'
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ steps.pr_number.outputs.result }}
with:
script: |
const pr = Number(process.env.PR_NUMBER);
const comments = (await github.rest.issues.listComments({
issue_number: pr,
owner: context.repo.owner,
repo: context.repo.repo
})).data
const comment = comments.filter(comment => comment.user.login === 'github-actions[bot]');
if (comment.length > 0) {
for (const c of comment) {
await github.graphql(`
mutation MinimizeComment($classifier: ReportedContentClassifiers!, $id: ID!) {
minimizeComment(input:{classifier: $classifier, subjectId: $id}) {
minimizedComment {
isMinimized
viewerCanMinimize
}
}
}
`, { classifier: 'OUTDATED', id: c.node_id });
}
}
- name: Post Validation Results (PR)
if: always() && steps.payload.outputs.event == 'pr'
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ steps.pr_number.outputs.result }}
with:
script: |
const summary = require('fs').readFileSync('summary.txt', 'utf-8');
const pr = Number(process.env.PR_NUMBER);
github.rest.issues.createComment({
issue_number: pr,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});