File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7272 packages : cynkra/fledge
7373 cache-version : fledge-1
7474
75+ - name : Count rulesets
76+ # Assume that branch is protected if ruleset exists
77+ id : rulesets
78+ env :
79+ GH_TOKEN : ${{ github.token }}
80+ run : |
81+ n_rulesets=$(gh api repos/${{ github.repository }}/rulesets -q length)
82+ echo "count=${n_rulesets}" >> $GITHUB_OUTPUT
83+ shell : bash
84+
7585 - name : Switch to branch if branch protection is enabled
76- if : github.ref_protected == 'true' || inputs.pr == 'true'
86+ if : github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0
7787 run : |
7888 git checkout -b fledge
7989 git push -f -u origin HEAD
@@ -83,14 +93,14 @@ jobs:
8393 env :
8494 GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
8595 run : |
86- check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' }}" != "true")
96+ check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0 }}" != "true")
8797 if (fledge::bump_version(which = "dev", no_change_behavior = "noop", check_default_branch = check_default_branch)) {
8898 fledge::finalize_version(push = TRUE)
8999 }
90100 shell : Rscript {0}
91101
92102 - name : Create and merge PR if branch protection is enabled
93- if : github.ref_protected == 'true' || inputs.pr == 'true'
103+ if : github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0
94104 env :
95105 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
96106 run : |
You can’t perform that action at this time.
0 commit comments