Skip to content

docs: update epic spec statuses to reflect current reality #27

docs: update epic spec statuses to reflect current reality

docs: update epic spec statuses to reflect current reality #27

Workflow file for this run

name: Validate Log Files
on:
pull_request:
paths:
- 'logs/CHANGELOG.md'
- 'logs/DEVLOG.md'
- 'logs/adr/*.md'
- '.logfile-config.yml'
push:
branches:
- main
- development
paths:
- 'logs/CHANGELOG.md'
- 'logs/DEVLOG.md'
- 'logs/adr/*.md'
- '.logfile-config.yml'
workflow_dispatch: # Allow manual trigger
jobs:
validate:
name: Validate Log Files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper validation
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml
- name: Run log linter
id: lint
run: |
python product/scripts/lint-logs.py --json > validation-results.json
EXIT_CODE=$?
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
exit $EXIT_CODE
continue-on-error: true
- name: Parse validation results
id: parse
run: |
# Parse JSON results and create summary
python -c "
import json
import sys
with open('validation-results.json', 'r') as f:
data = json.load(f)
total_errors = sum(r['errors'] for r in data['results'])
total_warnings = sum(r['warnings'] for r in data['results'])
print(f'total_errors={total_errors}')
print(f'total_warnings={total_warnings}')
# Create summary
summary = []
summary.append('## Log File Validation Results\n')
if total_errors == 0 and total_warnings == 0:
summary.append('✅ **All validations passed!**\n')
else:
if total_errors > 0:
summary.append(f'❌ **{total_errors} error(s) found**\n')
if total_warnings > 0:
summary.append(f'⚠️ **{total_warnings} warning(s) found**\n')
summary.append('\n### Details\n')
for result in data['results']:
summary.append(f'\n#### {result[\"file\"]}\n')
if not result['issues']:
summary.append('✅ No issues\n')
else:
for issue in result['issues']:
icon = {'error': '❌', 'warning': '⚠️', 'info': 'ℹ️'}[issue['severity']]
line_info = f\" (line {issue['line']})\" if issue['line'] else ''
summary.append(f'{icon} {issue[\"message\"]}{line_info}\n')
if issue['suggestion']:
summary.append(f' → {issue[\"suggestion\"]}\n')
with open('validation-summary.md', 'w') as f:
f.write(''.join(summary))
" > validation-vars.txt
cat validation-vars.txt >> $GITHUB_OUTPUT
- name: Upload validation results
uses: actions/upload-artifact@v4
if: always()
with:
name: validation-results
path: |
validation-results.json
validation-summary.md
retention-days: 30
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const summary = fs.readFileSync('validation-summary.md', 'utf8');
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Log File Validation Results')
);
const commentBody = summary + '\n\n---\n*Automated validation by Log File Genius*';
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
}
- name: Add job summary
if: always()
run: |
cat validation-summary.md >> $GITHUB_STEP_SUMMARY
- name: Check validation status
run: |
ERRORS=${{ steps.parse.outputs.total_errors }}
WARNINGS=${{ steps.parse.outputs.total_warnings }}
if [ "$ERRORS" -gt 0 ]; then
echo "❌ Validation failed with $ERRORS error(s)"
exit 1
elif [ "$WARNINGS" -gt 0 ]; then
echo "⚠️ Validation passed with $WARNINGS warning(s)"
exit 0
else
echo "✅ Validation passed with no issues"
exit 0
fi