-
Notifications
You must be signed in to change notification settings - Fork 26
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
Determine modified files for pull requests and pushes #24
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
That's the first step. The modified files are determined via pull/{pull_number}/files. This API call returns at most 3000 files. We use a page size of 30 and collect at most 10 pages, so that we have a total of 300 files - that's what we use for analyzing. This means for big changes, not all files might be analyzed.
Also add logging which mode is active.
This also sets the output parameter to zero.
Usually debug logging is enabled by adding a repository secret "ACTIONS_STEP_DEBUG" with value "true". However, this is secret not available if a PR runs from a forked repository...
This reverts commit 7f99864.
Let the unit tests run under macos and windows additionally.
The modified files are determined via compare API call. Similar to pull requests, we only collect at most 10 pages. However, the number of total changed files can't be calculated straightforward, since the pagination happens on the basis of commits rather than files. In any case, for big pushes this means, that not all files might be analyzed.
This always logs a warning if we fetched page MAX_PAGE regardless whether there would be more pages to fetch or not. No effort is done to determine whether the list of modified files is complete. Also the modified files are now collected in a Set to avoid duplicate entries.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Determine modified files for pull requests ✔️
That's the first step. The modified files are determined via pull/{pull_number}/files.
This API call returns at most 3000 files. We use a page size of 30 and collect at most
10 pages, so that we have a total of 300 files - that's what we use for analyzing.
This means for big changes, not all files might be analyzed.
Determine modified files for pushes ✔️
WIP - needs to be tested though.Works
Especially the case, if two commits modified the same file. -> github already combines these in the "files" property.
Handle cases when modified files can't be determined ✔️
For other events than push/pull_request (e.g. workflow_dispatch) no modified files are determined. The
action behaves as if the input parameter "analyzeModifiedFilesOnly" is set to "false".
Handle too many modified files ✔️
Now a warning is issued. That's probably enough for now, since creating annotations is also limited per workflow run (see https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md). The more files are modified, the more problems can be detected, which makes it more likely to hit the annotation limit.
Log output for this mode ✔️
This is done.
Which mode is active (analyzing all files or only modified files) should be logged in the build log, e.g. "Running PMD on path xyz" or "Running PMD on x files".The output is e.g: "Running PMD 6.41.0 on 2 modified files..." vs. "Running PMD 6.41.0 on all files in path src/main/java...".