-
-
Notifications
You must be signed in to change notification settings - Fork 707
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
GitHub Action: Fix authorized-changes-detection #1543
Conversation
Our Pull Request Approval ProcessWe have these basic policies to make the approval process smoother for our volunteer team. Testing Your CodePlease make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:
The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test the following with this PR to make sure this and all other tests run:
- A commit with changes to more than 20 files not in the list
- A commit with a test file added to the
.github
directory
You haven't done the tests I requested using this PR |
@palisadoes I apologize for any confusion. I am currently running tests, and I have noticed an issue related to the changed files. When printing the changed files, it shows an empty array. I believe this might be the reason why the sensitive file function is not running in this condition. Is there any change i should do to make it work |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1543 +/- ##
===========================================
- Coverage 96.74% 96.74% -0.01%
===========================================
Files 138 138
Lines 3688 3687 -1
Branches 1125 1125
===========================================
- Hits 3568 3567 -1
Misses 114 114
Partials 6 6 ☔ View full report in Codecov by Sentry. |
@palisadoes i changed the fetch-depth to 1 so it can clone the file name but that also deosn't seems to be working |
@palisadoes here's the working demo of unauthorized changes workflow integrared in pull_request.yml Screen.Recording.2024-02-16.at.11.00.57.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments
.github/workflows/check_files.py
Outdated
if unauthorized_changes: | ||
print("Error: Unauthorized changes detected. Please review the list of modified files:") | ||
for file in unauthorized_changes: | ||
print(f" - {file}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are printing the named tuple, not the files it contained. I've recommended another approach
We recently updated |
it will be deleted afterwards right??
added mentioned changes |
Yes, |
All changes are done from my side sir @palisadoes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the script:
- is python black, pylint, pycodestyle, flake8 and pydocstyle compliant.
- Has a maximum line width of 80 for better readability.
.github/workflows/check_files.py
Outdated
|
||
changed_files = [file.strip() for file in output.split(' ') if file.strip()] | ||
file_count = len(changed_files) | ||
return ScriptResult(file_count=file_count, unauthorized_changes=changed_files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, a named tuple isn't needed here. You are only using the file count later.
.github/workflows/check_files.py
Outdated
|
||
# Count changed files and check for unauthorized changes | ||
changed_files = _count_changed_files(base_branch, pr_branch) | ||
print(f"Number of changed files: {changed_files.file_count}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only print if the verbose flag is set
Please fix the conflicting file, so that this can be merged |
Sir, @palisadoes, I have deleted this file. How should I fix the conflicts? I guess after merging the changes, the conflicts will not show up. |
Try merging with the latest upstream and updating with a commit |
NOTE Read very carefully
This will put your PR at risk of extensive merge conflicts. Do the following IN THIS ORDER:
This will help to reduce the number of existing and future merge conflicts for your PR. |
6a910fc
into
PalisadoesFoundation:develop
This reverts commit 6a910fc.
What kind of change does this PR introduce?
Issue Number:
Fixes #1526
Did you add tests for your changes?
Snapshots/Videos:
If relevant, did you update the documentation?
Summary
Does this PR introduce a breaking change?
Other information
Have you read the contributing guide?