Skip to content

Commit

Permalink
Try another method
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif committed Mar 1, 2024
1 parent 52d993e commit 6501667
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,37 @@ jobs:
token: ${{ steps.github-token.outputs.token }}

- name: Get commit message 💬
id: get-commit-message
run: |
git config --global --add safe.directory $(pwd)
export head_commit_message="$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
echo "head_commit_message=$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "head_commit_message = $(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
if [[ $head_commit_message == *"[skip spelling]"* ]]; then
echo "Skip instruction detected."
exit 0
fi
shell: bash

- name: Normalize variables 📏
if: >
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
run: |
package_subdirectory_input="${{ inputs.package-subdirectory }}"
echo "package_subdirectory=${package_subdirectory_input:-.}" >> $GITHUB_ENV
shell: bash

- name: Run Spellcheck 👟
if: >
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
uses: insightsengineering/r-spellcheck-action@v2
with:
exclude: ${{ inputs.exclude }}
path: ${{ env.package_subdirectory }}

- name: Clean up WORDLIST 🧼
if: github.event_name == 'push'
if: >
github.event_name == 'push' &&
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
run: |
x <- readLines('inst/WORDLIST')
file.remove('inst/WORDLIST')
Expand All @@ -136,14 +143,18 @@ jobs:
shell: Rscript {0}

- name: Checkout to main 🛎
if: github.event_name == 'push'
if: >
github.event_name == 'push' &&
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
run: |
git fetch origin main
git checkout main
git pull origin main
- name: Set file pattern to commit ⚙️
if: github.event_name == 'push'
if: >
github.event_name == 'push' &&
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
id: file-pattern
run: |
if [[ "${{ inputs.package-subdirectory }}" == "." ]]; then
Expand All @@ -155,7 +166,9 @@ jobs:
shell: bash

- name: Commit and push changes 📌
if: github.event_name == 'push'
if: >
github.event_name == 'push' &&
!contains(steps.get-commit-message.outputs.head_commit_message, '[skip spelling]') }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[skip ci] Update WORDLIST"
Expand Down

0 comments on commit 6501667

Please sign in to comment.