From 2195a16131055532c96a4d7899d2a9d444778d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 9 Jan 2024 07:01:59 -1000 Subject: [PATCH 1/2] Also run CI an the main/master branch When merging a passing PR which was not on top of the last commit of the main branch, we may break CI. This make sure a CI run is triggered when the main branch is updated. As GitHub kindly display the status of the last commit on a project page, this allow to quickly see if a module CI works as intended or not. The main branch of most of our modules is `master` but a few use the more inclusive `main` name, so enable ci for both. --- moduleroot/.github/workflows/ci.yml.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moduleroot/.github/workflows/ci.yml.erb b/moduleroot/.github/workflows/ci.yml.erb index 5d66b666..209c72fc 100644 --- a/moduleroot/.github/workflows/ci.yml.erb +++ b/moduleroot/.github/workflows/ci.yml.erb @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} From 28a40a653d69f152cbe464de389be2d9977220a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 22 Jan 2024 07:57:17 -1000 Subject: [PATCH 2/2] Make the main branches tunable Some consumers of modulesync want to enable this for e.g. a `develop` branch, so make it tunable and use the `main` and `master` names as default value for this new setting which should work out-of the box for most cases. --- config_defaults.yml | 1 + moduleroot/.github/workflows/ci.yml.erb | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config_defaults.yml b/config_defaults.yml index d22d2686..7dfe9140 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -5,6 +5,7 @@ pidfile_workaround: false additional_packages: '' acceptance_tests: true + main_branches: ['main', 'master'] # PDK creates this .github/workflows/puppet-lint.yml: delete: true diff --git a/moduleroot/.github/workflows/ci.yml.erb b/moduleroot/.github/workflows/ci.yml.erb index 209c72fc..3486151d 100644 --- a/moduleroot/.github/workflows/ci.yml.erb +++ b/moduleroot/.github/workflows/ci.yml.erb @@ -8,8 +8,9 @@ on: pull_request: {} push: branches: - - main - - master +<%- @configs['main_branches'].each do |main_branch| -%> + - <%= main_branch %> +<%- end -%> concurrency: group: ${{ github.ref_name }}