diff --git a/README.md b/README.md index 59d60f9..0d7dbb6 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,17 @@ Used to trigger CI workflows on a schedule. This workflow allows multiple branches to have CI workflows run on a schedule, rather than just the default branch. -For modules that are to be scheduled once per week, the cron must be run two times per week on consecutive days. This is done because there is logic in action.yml to run one job on the CMS 4 branches on "even" days of the week and CMS 5 branches on "odd" days of the week. +For modules that are to be scheduled once per week, the cron must be run two times per week on consecutive days. This is done because there is logic in action.yml to run one job for the latest patch branch on the previous major on "even" days of the week and the next minor branch for the current major on "odd" days of the week. -For builds that are to be scheduled once per day, specifically `silverstripe/installer` and `silverstripe/recipe-kitchen-sink`, the cron must be run two times per day on consecutive hours, because for these modules CMS 4 branches are run on "even" hours and CMS 5 branches are run on "odd" hours. +For builds that are to be scheduled once per day, specifically `silverstripe/installer` and `silverstripe/recipe-kitchen-sink`, the cron must be run two times per day on consecutive hours, because for these modules branches on the previous major version are run on "even" hours and branches on the current major version are run on "odd" hours. +### Disabling branches on previous major version + +If the previous major version reaches the point in its life cycle where it is only receiving security fixes and no longer needs the cron job to run, it can be disabled by setting `RUN_BRANCHES_ON_PREVIOUS_MAJOR: "false"` in the `Check if should dispatch workflow` step in `actions.yml`. + +Remember to set this to `true` when a new major version is released. + +```yml ### Usage **.github/workflows/dispatch-ci.yml** diff --git a/action.yml b/action.yml index 857f6be..e8ba3ee 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,18 @@ runs: fi echo "type=$type" >> $GITHUB_OUTPUT + - name: Check if should dispatch workflow + shell: bash + env: + RUN_BRANCHES_ON_PREVIOUS_MAJOR: "false" + TYPE: ${{ steps.gettype.outputs.type }} + run: | + major_type=$(echo $TYPE | cut -d "," -f 1) + if [[ $RUN_BRANCHES_ON_PREVIOUS_MAJOR == "false" ]] && [[ $major_type == "previous" ]]; then + echo "Workflow is configured to not dispatch workflow for branches on previous major. Exiting." + exit 0 + fi + - name: Get branch id: getbranch shell: bash