Skip to content

Commit

Permalink
ci: Correctly detect branch protection (#354)
Browse files Browse the repository at this point in the history
* ci: Correctly detect branch protection

* chore: Auto-update from GitHub Actions

Run: https://github.com/r-dbi/RMariaDB/actions/runs/11947406800
  • Loading branch information
krlmlr authored Nov 21, 2024
1 parent c676d09 commit 666f366
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/fledge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,18 @@ jobs:
packages: cynkra/fledge
cache-version: fledge-1

- name: Count rulesets
# Assume that branch is protected if ruleset exists
id: rulesets
env:
GH_TOKEN: ${{ github.token }}
run: |
n_rulesets=$(gh api repos/${{ github.repository }}/rulesets -q length)
echo "count=${n_rulesets}" >> $GITHUB_OUTPUT
shell: bash

- name: Switch to branch if branch protection is enabled
if: github.ref_protected == 'true' || inputs.pr == 'true'
if: github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0
run: |
git checkout -b fledge
git push -f -u origin HEAD
Expand All @@ -83,14 +93,14 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' }}" != "true")
check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0 }}" != "true")
if (fledge::bump_version(which = "dev", no_change_behavior = "noop", check_default_branch = check_default_branch)) {
fledge::finalize_version(push = TRUE)
}
shell: Rscript {0}

- name: Create and merge PR if branch protection is enabled
if: github.ref_protected == 'true' || inputs.pr == 'true'
if: github.ref_protected == 'true' || inputs.pr == 'true' || steps.rulesets.outputs.count > 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions R/dbQuoteLiteral_MySQLConnection.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dbQuoteLiteral_MySQLConnection <- function(conn, x, ...) {

if (inherits(x, "POSIXt")) {
return(dbQuoteString(
conn,
strftime(as.POSIXct(x), "%Y%m%d%H%M%S", tz = "UTC")
))
conn,
strftime(as.POSIXct(x), "%Y%m%d%H%M%S", tz = "UTC")
))
}
callNextMethod()
}
Expand Down
1 change: 0 additions & 1 deletion R/quote-mysql.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
#' @keywords internal
#' @name mysql-quoting
NULL

2 changes: 1 addition & 1 deletion man/Client-flags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/dbConnect-MariaDBDriver-method.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/mariadb-tables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/query.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 666f366

Please sign in to comment.