From 8b5d15fd7e4dc713348e3efa9d0c703a73ece07d Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 30 Jun 2022 13:17:14 +1200 Subject: [PATCH] DOC Only run crons on base account --- .github/workflows/ci.yml | 3 +++ README.md | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d9c7ca..3b775b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,7 @@ jobs: GITHUB_REF: ${{ github.ref }} GITHUB_REF_NAME: ${{ github.ref_name }} GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_EVENT_NAME: ${{ github.event_name }} steps: - name: Context run: | @@ -65,6 +66,8 @@ jobs: # gitbub.repository - The owner and repository name. For example, Codertocat/Hello-World # On forked repos, this will show / echo "github.repository: $GITHUB_REPOSITORY" + # github.event_name - The event that triggered the workflow + echo "github.event_name: $GITHUB_EVENT_NAME" # Generates a dynamic matrix of jobs to run tests on based on the inputs provided genmatrix: diff --git a/README.md b/README.md index 2db6973..9b4b718 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,36 @@ on: jobs: ci: + name: CI uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 ``` +#### Running on a regular schedule + +```yml +on: + # Run once per week + schedule: + - cron: '0 0 * * 1' + +jobs: + ci: + name: CI + # Only run the cron on the account hosting this repository, not on the accounts of forks + # github.repository take the form of AccountName/repository-name + # Change '/' to match the name of the account hosting this repository + if: (github.event_name == 'schedule' && startsWith(github.repository, '/')) || (github.event_name != 'schedule') + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 +``` + +#### Job configuration + Set config specific to your needs via "inputs" defined under the `with:` key. For instance, to disable PHP linting because your module does not yet have a `phpcs.xml.dist` file ```yml jobs: ci: + name: CI uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 with: phplinting: false