add check csv-header to github CI #42
Workflow file for this run
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
name: Smoke Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
smoke-test: | |
strategy: | |
matrix: | |
args: | |
- "--invites" | |
- "--commits" | |
- "--pull_requests" | |
- "--issues" | |
- "--wikis" | |
- "--contributors" | |
- "--workflow_runs" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Create list.txt | |
run: echo "thehighestmath/SummerPractice" > list.txt | |
- name: Run test | |
run: | | |
python3 main.py ${{ matrix.args }} --token ${{ secrets.TEST_TOKEN_GITHUB }} --list list.txt --out out.csv --branch master | |
- name: Check if out.csv exists | |
run: ls out.csv | |
- name: Fail if out.csv does not exist | |
if: failure() | |
run: exit 1 | |
- name: Check header in first line | |
run: | | |
HEADER="repository name,author name,author login,author email,date and time,changed files,commit id,branch" | |
FIRST_LINE=$(head -n 1 out.csv) | |
if [[ "$FIRST_LINE" == "$HEADER"* ]]; then | |
echo "Header is valid" | |
else | |
echo "Header is invalid" | |
exit 1 | |
fi | |
- name: Show out.csv | |
run: cat out.csv |