Synchronize Assertions #815
This file contains 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
# This is a workflow that generates the current list of assertions in csv format every day | |
name: Synchronize Assertions | |
# Controls when the workflow will run | |
on: | |
schedule: | |
- cron: "00 00 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job to push the assertions | |
sync-assertioncsv: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Install Dependencies | |
run: npm install | |
- name: Copy Template.csv | |
# This is done so that it can be compared later on | |
run: | | |
mkdir .temp | |
cp testing/assertions.csv .temp/assertions.current.csv | |
cat .temp/assertions.current.csv | |
- name: generate template.csv | |
# this generates other stuff as well but we are interested in template.csv | |
run: node testing/extractFile.js > testing/assertions.csv | |
- name: Look for changes | |
continue-on-error: true | |
run: | | |
cat testing/assertions.csv | |
git diff --no-index testing/assertions.csv .temp/assertions.current.csv | |
echo "::set-output name=changed::$?" | |
id: diff | |
- name: Sync file | |
if: ${{ ! steps.diff.outputs.changed }} | |
run: rm -rf .temp | |
- name: Add generated file and commit | |
if: ${{ ! steps.diff.outputs.changed }} | |
run: | | |
git config user.name 'Ege Korkan' | |
git config user.email '[email protected]' | |
git reset | |
git add testing/assertions.csv | |
git commit -m "chore(testing): sync assertions.csv with the current assertions in the spec" | |
- name: Create Pull Request | |
if: ${{ ! steps.diff.outputs.changed }} | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
add-paths: | | |
testing/assertions.csv | |
branch: assertion-csv-sync | |
delete-branch: true | |
title: "Update assertions.csv for testing" | |
body: | | |
Update template.csv | |
- Updated with *today's* date | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request |