From ad4953aa787bd12ae7b283be4c8a795844577d18 Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Mon, 6 May 2024 09:00:54 -0500 Subject: [PATCH 1/2] Disable auto-commits Disable auto commits until the unicode styling issues have been fixed. Signed-off-by: cicdguy <26552821+cicdguy@users.noreply.github.com> --- .github/workflows/style.yaml | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 4572694a..68658663 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -125,7 +125,9 @@ jobs: ext %in% c("R", "Rmd", "Rnw", "Rmarkdown", "qmd") } changed_r_files <- Filter(is_r_file, changed_files) - dry <- if(isTRUE(as.logical("${{ inputs.auto-update }}"))) "off" else "on" + # TODO: Re-enable after styler unicode issues are fixed + #dry <- if(isTRUE(as.logical("${{ inputs.auto-update }}"))) "off" else "on" + dry <- "on" detect <- styler::style_file(changed_r_files, dry = dry) if (TRUE %in% detect$changed) { problems <- subset(detect$file, detect$changed == T) @@ -153,23 +155,24 @@ jobs: echo "unstyled-files=$(cat /tmp/style-problems.txt)" >> $GITHUB_OUTPUT shell: bash - - name: Autocommit styled files ↗️ - id: autocommit-styled-files - if: > - inputs.auto-update - && steps.check_files.outputs.files_exists == 'true' - run: | - git config --global user.name 'github-actions' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - git config pull.rebase false - git pull origin ${{ steps.branch-name.outputs.head_ref_branch }} || true - git add ${{ steps.problem-files.outputs.unstyled-files }} - git commit -m '[skip style] [skip vbump] Restyle files' - git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} || \ - echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" - shell: bash - working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} - continue-on-error: true + # TODO: Re-enable after styler unicode issues are fixed + #- name: Autocommit styled files ↗️ + # id: autocommit-styled-files + # if: > + # inputs.auto-update + # && steps.check_files.outputs.files_exists == 'true' + # run: | + # git config --global user.name 'github-actions' + # git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + # git config pull.rebase false + # git pull origin ${{ steps.branch-name.outputs.head_ref_branch }} || true + # git add ${{ steps.problem-files.outputs.unstyled-files }} + # git commit -m '[skip style] [skip vbump] Restyle files' + # git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} || \ + # echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" + # shell: bash + # working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} + # continue-on-error: true - name: Styler check summary 🅾 if: > From d7896419a9915674584b1eb03bffb711c43c7f9b Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Mon, 6 May 2024 09:22:19 -0500 Subject: [PATCH 2/2] fix: Handle missing problem list file --- .github/workflows/style.yaml | 53 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 68658663..1d031c47 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -155,24 +155,25 @@ jobs: echo "unstyled-files=$(cat /tmp/style-problems.txt)" >> $GITHUB_OUTPUT shell: bash - # TODO: Re-enable after styler unicode issues are fixed - #- name: Autocommit styled files ↗️ - # id: autocommit-styled-files - # if: > - # inputs.auto-update - # && steps.check_files.outputs.files_exists == 'true' - # run: | - # git config --global user.name 'github-actions' - # git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - # git config pull.rebase false - # git pull origin ${{ steps.branch-name.outputs.head_ref_branch }} || true - # git add ${{ steps.problem-files.outputs.unstyled-files }} - # git commit -m '[skip style] [skip vbump] Restyle files' - # git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} || \ - # echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" - # shell: bash - # working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} - # continue-on-error: true + - name: Autocommit styled files ↗️ + id: autocommit-styled-files + if: false + # TODO: Re-enable after styler unicode issues are fixed + #if: > + # inputs.auto-update + # && steps.check_files.outputs.files_exists == 'true' + run: | + git config --global user.name 'github-actions' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + git config pull.rebase false + git pull origin ${{ steps.branch-name.outputs.head_ref_branch }} || true + git add ${{ steps.problem-files.outputs.unstyled-files }} + git commit -m '[skip style] [skip vbump] Restyle files' + git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} || \ + echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" + shell: bash + working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} + continue-on-error: true - name: Styler check summary 🅾 if: > @@ -187,12 +188,14 @@ jobs: "or simply run the following commands", "for an immediate fix:\n" )) - cat("────────────────────────────────────────\n") - cat(paste0( - "styler::style_file(", - readLines("/tmp/style-problems.R", warn=FALSE), - ")\n" - )) - cat("────────────────────────────────────────\n") + if (file.exists("/tmp/style-problems.R")) { + cat("────────────────────────────────────────\n") + cat(paste0( + "styler::style_file(", + readLines("/tmp/style-problems.R", warn=FALSE), + ")\n" + )) + cat("────────────────────────────────────────\n") + } quit(status = 1) shell: Rscript {0}