Made the script only run once a week #405
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
name: generate_reports | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: ["main"] | |
paths-ignore: | |
- "**/README.md" | |
pull_request: | |
branches: ["main"] | |
paths-ignore: | |
- "**/README.md" | |
# Weekly run of this workflow | |
schedule: | |
- cron: "0 0 * * 0" | |
# 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 called "validate-standaarden" | |
validate-standaarden: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
# Different Node versions. Each node version will trigger the action | |
node-version: | |
- 20.x | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Runs a single command using the runners shell | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Build project | |
run: npm run build:clean | |
- name: Generate the reports | |
shell: bash | |
run: | | |
# make file runnable, might not be necessary | |
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/run_generate_reports.sh" | |
# run script | |
"${GITHUB_WORKSPACE}/.github/scripts/run_generate_reports.sh" | |
- name: Commit and push changes | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git status | |
ls -al | |
ls -al ./report | |
git add . | |
git diff --quiet && git diff --staged --quiet || (git commit -m "generated all the reports on `date +'%Y-%m-%d'`" && git push) | |
git push |