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 support for optional README path flag to list and track parts used in README file. #840

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

rudra-iitm
Copy link
Contributor

This update introduces a new --readme-path argument that allows users to specify the file path to the README (or any Markdown file) where the parts used in a YAML file (such as snapcraft or rockcraft) will be listed (with their updated versions).

Key Changes:

  • New Argument: The --readme-path argument is added to specify the path to the target README file.

Usage:

  • Users can now provide the path to the README file using the --readme-path flag. For example:
     --readme-path: 'path/to/readme/file'
  • User need to comment this in specified README file
    <!-- Begin Included Components -->
    
    <!-- End Included Components -->
    

This will automatically list the parts (with their updated version) used in the YAML file within the specified Markdown file, as demonstrated in the image below.
Screenshot 2024-12-23 at 11 01 24 AM

@rudra-iitm
Copy link
Contributor Author

@sergio-costas Could you please review this PR? Regarding the test failures, the unittests are still passing locally, but they seem to fail in the workflow due to a 403 status code error. This might be caused by rate limiting on the GitHub API.

Copy link
Collaborator

@sergio-costas sergio-costas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some little details.

for part in parts if part
])
formatted_contents = f"## Included Components\n{parts_contents}"
updated_readme = re.sub(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a check for the existence of the tags would be a good idea. That allows to ensure that they are correct (a typo would result in the data not being updated).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check for the existence of a tag? The included components are defined in the snapcraft.yaml file, not determined by the user. If there is any typo, it will automatically be corrected in the next workflow run as defined in the snapcraft.yaml file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean: if the user specifies a README file, do check in that README if the <!-- Begin Included Components --> and <!-- End Included Components --> tags are specified in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

updatesnap/updatesnapyaml.py Outdated Show resolved Hide resolved
for part in parts if part
])
formatted_contents = f"## Included Components\n{parts_contents}"
updated_readme = re.sub(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean: if the user specifies a README file, do check in that README if the <!-- Begin Included Components --> and <!-- End Included Components --> tags are specified in it.

Copy link
Collaborator

@sergio-costas sergio-costas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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

Successfully merging this pull request may close these issues.

2 participants