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

Add option to only check changed files? #65

Open
Justin-JHG opened this issue May 4, 2023 · 2 comments
Open

Add option to only check changed files? #65

Justin-JHG opened this issue May 4, 2023 · 2 comments

Comments

@Justin-JHG
Copy link

Hi is it possible to add an option so that this action only checks files changed in the current pull request?

thanks

@Justin-JHG
Copy link
Author

Justin-JHG commented May 5, 2023

update, this is similar to issue #38

so this github action does support only check input list of files, for example only the files changed in the current pull request.

I did make it work and will attach my full workflow below, before that I will list the issues with this Github Action:

hope this helps anyone want to use this action for the same purpose, thanks

workflow for spelling check changed files in the pull request:

name: 🚥 Codespell

# workflow to check spelling errors on the changed files within the current pull request

on:
  pull_request:
    types: [opened, edited, synchronize]

jobs:
  codespell:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: 🔸 Get Changed Files from Pull Request
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          # get file names and seperate them with space ' '
          files=$(gh pr diff ${{ github.event.pull_request.number }} --name-only | xargs -I {} sh -c 'echo "./{}"' | tr '\n' ' ')
          echo "CHANGED_FILES=$files" >> "$GITHUB_ENV"          

      - name: 🔸 Output Changed Files
        run: echo ${{ env.CHANGED_FILES }}
          
      - name: 🔸 Check for Spelling Errors for Changed Files
        uses: codespell-project/actions-codespell@v1
        with:
          check_filenames: true
          skip: nothing
          path: ${{ env.CHANGED_FILES }}

@akien-mga
Copy link

akien-mga commented May 8, 2023

Thanks for documenting your workflow, I came here to suggest the same feature and could use your insights to implement the same in godotengine/godot#76828.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants