-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/1 initial repository setup #2
Conversation
- Update of README.md. - Created alternative solution for current control sh file.
core.setFailed('No "Release notes" found in PR comments') | ||
} else { | ||
console.log('"Release notes" found in comments'); | ||
} |
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.
} | |
} | |
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.
Fixed in commit - 0c435b7.
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const newTag = core.getInput('tag-name'); |
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.
line 5 is tagName
here it is tag-name
. Why?
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.
Fixed in commit - 0c435b7.
on: | ||
pull_request: | ||
types: [closed] | ||
branches: [ master ] | ||
|
||
jobs: | ||
copy_release_notes: | ||
if: github.event.pull_request.merged == true |
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.
Why not on push
to master
?
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.
The logic is to migrate all Release notes comments from PR to related Issues only when PR is closed.
By push, there would be repeated duplication.
body: commentBody | ||
}); | ||
} | ||
} |
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.
} | |
} | |
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.
Fixed in commit - 0c435b7.
run: | | ||
echo "Extracted Release Note Body:" | ||
echo "${{ steps.get-comments.outputs.releaseNoteBody }}" | ||
echo "RELEASE_NOTE_BODY<<EOF" >> $GITHUB_ENV |
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.
Is this maybe missing a =
?
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.
Where?
const regexPattern = /([Cc]los(e|es|ed)|[Ff]ix(es|ed)?|[Rr]esolv(e|es|ed))\s*#\s*([0-9]+)/g; | ||
|
||
let match; | ||
while ((match = regexPattern.exec(description)) !== null) { |
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.
I have an issue to wrap my head around this one
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.
This is a regex detector of the mentioned Issue in the PR description. It does not look nice, yes.
.gitignore
Outdated
#.idea/ | ||
/.idea/ |
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.
pick one
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.
Addressed in commit - bcb84a5.
README.md
Outdated
- **Submit Pull Requests**: Feel free to fork the repository, make changes, and submit a pull request. Please ensure your code adheres to the existing style and all tests pass. | ||
- **Report Issues**: If you encounter any bugs or issues, please report them via the repository's [Issues page](https://github.com/AbsaOSS/living-doc-generator/issues). | ||
- **Suggest Enhancements**: Have ideas on how to make this action better? Open an issue to suggest enhancements. | ||
|
||
Before contributing, please review our [contribution guidelines](https://github.com/AbsaOSS/living-doc-generator/blob/master/CONTRIBUTING.md) for more detailed information. |
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.
- **Submit Pull Requests**: Feel free to fork the repository, make changes, and submit a pull request. Please ensure your code adheres to the existing style and all tests pass. | |
- **Report Issues**: If you encounter any bugs or issues, please report them via the repository's [Issues page](https://github.com/AbsaOSS/living-doc-generator/issues). | |
- **Suggest Enhancements**: Have ideas on how to make this action better? Open an issue to suggest enhancements. | |
Before contributing, please review our [contribution guidelines](https://github.com/AbsaOSS/living-doc-generator/blob/master/CONTRIBUTING.md) for more detailed information. | |
Before contributing, please review our [contribution guidelines](https://github.com/AbsaOSS/living-doc-generator/blob/master/CONTRIBUTING.md) for more detailed information. |
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.
Addressed in commit - bcb84a5.
- Not test run.
…dding py files into dist.
- Improving return of liv-doc root.
Release notes:
|
See the default action step definition: | ||
|
||
```yaml | ||
- name: Generate Living Documentation |
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.
May change name to Living Documentation Generator
everywhere in README as it is in action.yml 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.
I have checked the file and fixed capital in 1st line. Other variations in the file still make sense to me.
Please provide reasons for the change in local meanings.
import re | ||
|
||
|
||
def extract_args(): |
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.
Type hints and proper method / script documentation has to be added to the whole controller.py
.
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.
Please address this in the SPIKE issue as one of the goals.
run_script('convert_features_to_pages.py', env_vars) | ||
|
||
|
||
if __name__ == '__main__': |
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.
Here is different pattern, than we usually have in our scripts, where we don't initialize main method. I would refactor the code so the scripts are consistent.
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.
Please address this in the SPIKE issue as one of the goals.
This version aimed to provide a migrated solution that worked well enough to close previous projects.
No deep analysis was included, as this step prevented us from developing the final project.
|
||
if __name__ == '__main__': | ||
print("Starting Living Documentation generation.") | ||
main() |
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.
This PR is seriously very big, almost no one will be able to review it fully in detail within reasonable amount of time. Better would be to create a few smaller ones. In your case, in particular, you could add one script at a time. One PR for clean_env_before_mining.py
and related functionality, another for github_query_issues.py
etc.
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.
This version aimed to provide a migrated solution that worked well enough to close previous projects.
The Python scripts are the goal of that migration. We are working on collecting refactoring notes in parallel.
- in a previous project
- in a local project in SPIKE issue
Yes, it is big, but the script is the same. Only the main method and env variables loading differ.
All scripts need to be refactored. Adding a format check and using OOP will be the first steps; then, more reviews should follow.
env.update(env_vars) | ||
|
||
# Running the script with updated environment | ||
result = subprocess.run(['python3', script_name], env=env, text=True, capture_output=True, check=True) |
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.
calling Python from Python using subprocess is definitely not that common. Why not to call it directly? If env vars are the only reason, you can encapsulate them into a data class (I proposed something like that already in: #4 (comment)) and pass to each main function of each module, just an example.
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 the solution proposal linked on following review comment.
src/controller.py
Outdated
|
||
# Clean environment before mining | ||
print("Data mining for Living Documentation") | ||
run_script('clean_env_before_mining.py', env_vars) |
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.
hardcoding python script name like this is definitely weird. I'd just import and call it directly as a standard Python call
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.
I have prepared a solution proposal for the clean script - see commit 56c6fc9.
@MobiTikula, Can you address the refactoring of the rest of the scripts in SPIKE?
# Set to store the names of repositories that have been used | ||
set_of_used_repos = set() | ||
|
||
if os.path.isdir(PROJECT_DIRECTORY): |
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.
this function is quite nested and I feel like almost a bit too long. Consider simplifying it and perhaps even break it down into multiple functions.
Btw, I like this approach to 'flatten' the code a bit - instead of:
if something:
do_something_complex_and_nested
to:
if not something:
return
do_something_complex_and_nested
by following this second approach, your do_something_complex_and_nested
code block is not nested any more :)
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.
This is cool: https://peps.python.org/pep-0020/
Flat is better than nested.
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.
As this was overtaken by migration, let's make this a note to refactor SPIKE @MobiTikula .
Create the initial version of the project.
Populate by logic from the origin project and integrate.
Closes #1