Closed vybhav72954 closed 3 years ago
What do you mean it runs on the whole code base? You have it specified to run on only pull_request. Are you saying it is running on pushes to master? If so, that doesn't make sense unless there is more in your config that you aren't showing.
I will post my config file yml file and screenshot here 😄
my workflow file-
My Conifg File
matrix:
- name: Markdown
aspell:
lang: en
dictionary:
wordlists:
- .github/linters/.wordlist.txt
encoding: utf-8
pipeline:
- pyspelling.filters.markdown:
- pyspelling.filters.html:
comments: false
ignores:
- code
- pre
sources:
- '**/*.md'
default_encoding: utf-8
The Action going through whole codebase
Is the
sources:
- '**/*.md'
causing this? (In the config file)
I'm still confused. It looks like it is going through your Markdown files as you specified.
I still don't know what you mean by going through your "whole codebase". It looks like it is doing exactly what you are telling it to do. If not, you'll have to be more clear.
Yes, it is going through all the Markdown Files in my whole Repo!!!
My point is, is it possible, that it runs on only those md
files, which are edited or modified in a PR only.
Just as example
You can see that I only have 1 md
file in this PR, but the action running on all the md
files. What I am trying to say is, can I do something, so that it runs on only the files modified in the PR, in this case, Troubleshoot.md
Linked PR - HarshCasper/Rotten-Scripts#698
PySpelling does not check git status of files. I guess you could come up with an elaborate system that gathers git status of files and generates or modifies a pyspelling config to target only the files in the pull request.
It's possible it could be added as a feature in PySpelling at some point. I'm not promising such a feature, just mentioning that it might be a possibility. What I don't want to do is open the door for supporting multiple version control system status, as that would kind of be a pain.
I understand your point. So as of now, I believe that one such functionality is not a part of the project.
I can definitely come up with ideas to implement this. You can certainly close the issue now, if I will come up with something I will open a PR and will reopen the issue, only if you think that contribution is required that is.
Well, this repository is the GitHub action. I do not maintain this repository. It is mainly a wrapper around PySpelling (which I do maintain). If I were to integrate such functionality it would be there: https://github.com/facelessuser/pyspelling. I assume there would be some kind of hook to filter out files that were captured by the source pattern. If I did this, maybe people could use a plugin to override the hook to filter by git status or whatever. Again, I haven't put much thought into this yet, nor am I committing to such a thing, but that is just what I'm thinking right now.
I'm actually working on getting this added @vybhav72954. I have the same use case as you. Currently, this GitHub Action uses the sources specified in the pyspelling.yaml
file (or config_path
override passed into the Action). This means your sources:
section would need to have a list of the changes files in your PR, which is a pain to achieve.
I'm putting together a PR to allow you to provide a list of files to the GitHub Action, which will be passed into PySpelling in the form of --name <task_name> --source <path1> --source <path2>
flags. Provided that gets merged in, it'll serve your purpose.
To get a list of changes files in the PR, I currently use this config in my GitHub Actions test file:
name: Check files
on: [pull_request, push]
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check out source files
uses: actions/checkout@v2
- name: Get a list of changed files
uses: jitterbit/get-changed-files@v1
id: changed_files
- name: Run initial tests
run: ./tests.sh ${{ steps.changed_files.outputs.all }}
So the only thing I've not taken care of here is only checking *.md
files.
- name: Detect Files
uses: dorny/paths-filter@v2.6.0
id: filter
with:
# Enable listing of files matching each filter.
# Paths to files will be available in `${FILTER_NAME}_files` output variable.
# Paths will be escaped and space-delimited.
# Output is usable as command-line argument list in linux shell
list-files: shell
# In this example changed files will be checked by linter.
# It doesn't make sense to lint deleted files.
# Therefore we specify we are only interested in added or modified files.
filters: |
python:
- added|modified: '**.py'
I use something like this to detect changed files in a PR in one of my Repos. (For Python here)
Nice, so that pretty much covers it all off, once my is approved, I think?
Seems like it, but it still depends on the Owner, whether he wants to incorporate another action or hard code it himself, but for now I believe your PR can solve this issue. Will test run once then update
This is closed by #34
Even though am using:
The action still runs on the Whole Codebase.
This makes action really slow for a huge Repository, it would be great if we can only check files modified in a PR.