diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 6c3c9cd4..b622c480 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -80,13 +80,10 @@ jobs: uses: ./.github/workflows/dep-suggests-matrix - uses: ./.github/workflows/update-snapshots - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - uses: ./.github/workflows/style - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - uses: ./.github/workflows/roxygenize - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - name: Remove config files from previous iteration run: | @@ -94,7 +91,6 @@ jobs: shell: bash - id: commit - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository uses: ./.github/workflows/commit with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/commit/action.yml b/.github/workflows/commit/action.yml index 5b00fe33..ed6f9b89 100644 --- a/.github/workflows/commit/action.yml +++ b/.github/workflows/commit/action.yml @@ -20,9 +20,13 @@ runs: if [ -n "$(git status --porcelain)" ]; then echo "Changed" protected=${{ github.ref_protected }} - if [ "${protected}" = "true" ]; then + foreign=${{ github.event.pull_request.head.repo.full_name != github.repository }} + if [ "${foreign}" = "true" ]; then + # https://github.com/krlmlr/actions-sync/issues/44 + echo "Can't push to foreign branch" + elif [ "${protected}" = "true" ]; then current_branch=$(git branch --show-current) - new_branch=gha-commit + new_branch=gha-commit-$(git rev-parse --short HEAD) git checkout -b ${new_branch} git add . git commit -m "chore: Auto-update from GitHub Actions"$'\n'$'\n'"Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" @@ -38,6 +42,7 @@ runs: fi gh workflow run rcc -f ref=$(git rev-parse HEAD) + gh pr merge --merge --auto else git fetch if [ -n "${GITHUB_HEAD_REF}" ]; then @@ -50,8 +55,9 @@ runs: git add . git commit -m "chore: Auto-update from GitHub Actions"$'\n'$'\n'"Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" git push -u origin HEAD + + # Only set output if changed + echo sha=$(git rev-parse HEAD) >> $GITHUB_OUTPUT fi - # Only set output if changed - echo sha=$(git rev-parse HEAD) >> $GITHUB_OUTPUT fi shell: bash diff --git a/.github/workflows/dep-suggests-matrix/action.R b/.github/workflows/dep-suggests-matrix/action.R index 9673b704..eff3a502 100644 --- a/.github/workflows/dep-suggests-matrix/action.R +++ b/.github/workflows/dep-suggests-matrix/action.R @@ -21,9 +21,12 @@ get_deps <- function() { if (Sys.getenv("GITHUB_BASE_REF") != "") { print(Sys.getenv("GITHUB_BASE_REF")) - has_diff <- (system("git diff ${{ github.event.pull_request.base.sha }}... | egrep '^[+][^+]' | grep -q ::") == 0) + system("git fetch origin ${GITHUB_BASE_REF}") + # Use .. to avoid having to fetch the entire history + # https://github.com/krlmlr/actions-sync/issues/45 + has_diff <- (system("git diff origin/${GITHUB_BASE_REF}.. | egrep '^[+][^+]' | grep -q ::") == 0) if (has_diff) { - system("git diff ${{ github.event.pull_request.base.sha }}... | egrep '^[+][^+]' | grep -q ::") + system("git diff origin/${GITHUB_BASE_REF}.. | egrep '^[+][^+]' | grep -q ::") packages <- get_deps() } else { writeLines("No changes using :: found, not checking without suggested packages") diff --git a/R/as_duckplyr_tibble.R b/R/as_duckplyr_tibble.R index 8ebee5a9..dcb30646 100644 --- a/R/as_duckplyr_tibble.R +++ b/R/as_duckplyr_tibble.R @@ -2,7 +2,7 @@ #' #' `as_duckplyr_tibble()` converts the input to a tibble and then to a duckplyr data frame. #' -#' @return For `as_duckplyr_df()`, an object of class +#' @return For `as_duckplyr_tibble()`, an object of class #' `c("duckplyr_df", class(tibble()))` . #' #' @rdname as_duckplyr_df