Skip to content

Merge branch 'main' of https://github.com/JimBLogic/CyberDailyLog #20

Merge branch 'main' of https://github.com/JimBLogic/CyberDailyLog

Merge branch 'main' of https://github.com/JimBLogic/CyberDailyLog #20

Workflow file for this run

name: "Validate CSV"
on:
push:
paths:
- "daily-log.csv"
pull_request:
paths:
- "daily-log.csv"
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install test deps
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run unit tests
run: |
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
pytest -q
- name: Run validator (capture output)
id: runvalidator
run: |
set -e
python3 scripts/validate_csv.py > validator-output.txt 2>&1 || true
rc=$?
echo "rc=$rc"
echo "::set-output name=rc::$rc"
- name: Comment on PR with validator output
if: ${{ github.event_name == 'pull_request' && steps.runvalidator.outputs.rc != '0' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const out = fs.readFileSync('validator-output.txt', 'utf8');
const body = `CSV validator found issues:\n\n```
+ out + '\n```';
const pr = context.payload.pull_request.number;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr,
body: body
});