Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable auto-commits for styler workflow #227

Merged
merged 2 commits into from
May 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all seems to be good but wouldn't be easier just to introduce if FALSE ? :) just thinking loud

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating that also but false in JS and YAML are the same - and didn't want to keep it ambiguous to the expression resolver.

# 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: >
Expand Down
Loading