Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Disable dispatch for branches on previous major #14

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

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.

### Usage

Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading