From 3b4837740ae637a06d695ee2b720bbb0ae74eb4e Mon Sep 17 00:00:00 2001 From: cicdguy <26552821+cicdguy@users.noreply.github.com> Date: Tue, 7 May 2024 03:15:04 -0500 Subject: [PATCH] Set LANG: en_US.UTF-8 to fix locale issue in rocker (#228) See https://github.com/r-lib/styler/issues/1199 and https://github.com/rocker-org/rocker-versioned2/pull/802 for reference. This adds the `LANG=en_US.UTF-8` environment variable in the event that it is not set. --- .github/workflows/roxygen.yaml | 26 +++++++++++++------------- .github/workflows/style.yaml | 14 ++++++-------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.github/workflows/roxygen.yaml b/.github/workflows/roxygen.yaml index 52c73347..eafb08c3 100644 --- a/.github/workflows/roxygen.yaml +++ b/.github/workflows/roxygen.yaml @@ -150,6 +150,8 @@ jobs: } shell: Rscript {0} working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} + env: + LANG: en_US.UTF-8 - name: Roxygen check 🅾 run: | @@ -163,19 +165,17 @@ jobs: # Attempt to commit and push man-page updates if [ "${AUTO_UPDATE}" == "true" ] then { - # TODO: Disable Roxygen auto-updates until unicode issues are fixed - : - #echo "Regenerating man pages via auto-update" - #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 - #BRANCH_NAME="${{ steps.branch-name.outputs.head_ref_branch }}" - #git pull origin ${BRANCH_NAME} || true - #git add -A man/ DESCRIPTION - #git commit -m "[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update" - #git push -v origin HEAD:${BRANCH_NAME} || \ - # (echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" && \ - # AUTO_UPDATE=failed) + echo "Regenerating man pages via auto-update" + 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 + BRANCH_NAME="${{ steps.branch-name.outputs.head_ref_branch }}" + git pull origin ${BRANCH_NAME} || true + git add -A man/ DESCRIPTION + git commit -m "[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update" + git push -v origin HEAD:${BRANCH_NAME} || \ + (echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)" && \ + AUTO_UPDATE=failed) } fi # If auto-update is disabled or is unsuccessful, let 'em know to fix manually diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 1d031c47..a918293a 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -125,9 +125,7 @@ jobs: ext %in% c("R", "Rmd", "Rnw", "Rmarkdown", "qmd") } changed_r_files <- Filter(is_r_file, changed_files) - # TODO: Re-enable after styler unicode issues are fixed - #dry <- if(isTRUE(as.logical("${{ inputs.auto-update }}"))) "off" else "on" - dry <- "on" + dry <- if(isTRUE(as.logical("${{ inputs.auto-update }}"))) "off" else "on" detect <- styler::style_file(changed_r_files, dry = dry) if (TRUE %in% detect$changed) { problems <- subset(detect$file, detect$changed == T) @@ -140,6 +138,8 @@ jobs: } shell: Rscript {0} working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }} + env: + LANG: en_US.UTF-8 - name: Check file existence 🤔 id: check_files @@ -157,11 +157,9 @@ jobs: - 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' + 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'