-
Notifications
You must be signed in to change notification settings - Fork 9
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 Argument to Specify YAML File Path #813
Conversation
@sergio-costas , please review this PR. The unittests are passing successfully; however, the style check is failing for a file that I did not modify. The error states "too-many-positional-arguments", even though Pylint is explicitly disabled for that line. I’m unable to determine the cause of this failure. |
@rudra-iitm I'll check it. |
Mmm... odd... in local it does work... Maybe updating the ubuntu version to ubuntu-noble (ubuntu-latest isn't "the latest one", but... 18.04 I think) and python version to 3.12 in the .github/workflows/updatesnaptests.yml file... |
(I don't want to send a patch for that because every time that I tried to send a commit to a PR that wasn't mine, I broke the git history. So I prefer to stay in the safe side 😅 ) |
I am working on a Mac and using Python 3.12. The style check is still failing locally for me. |
😅 Better safe than sorry |
Mmm... which version of pylint and flake8 do you have? Mine are:
|
I found how to fix it. Please, remove your changes in the workflows and rebase against |
@rudra-iitm I cancelled the test because I was wrong: it's not "ubuntu-noble" but "ubuntu-24.04". Anyway, in the main branch is everything fixed, so just removing that last commit and rebasing should be enough. |
20e3d9d
to
d3f805a
Compare
Done rebasing |
And checks have passed :-) |
Could you please review the changes and merge the PR? |
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.
Some details.
Yes, sorry... I reviewed it yesterday, but forgot to press the button to commit it. |
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.
Some nitpicks.
updatesnap/updatesnapyaml.py
Outdated
@@ -76,6 +83,8 @@ def main(): | |||
help='Version schema of snapping repository') | |||
parser.add_argument('--rock-version-schema', action='store', default='None', | |||
help='Version schema of rock repository') | |||
parser.add_argument('--yaml-path', action='store', default='None', |
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 think that it would be better to use None
instead of the string "None"
. Like in github-user
and github-token
.
Also, I see that version-schema
and rock-version-schema
also use a string instead of the None
native type... I think that it should be fixed in another PR.
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 will do it in new PR for version-schema and rock-version-schema.
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 think there is an issue when using None instead of 'None', as action.yml sends 'None' when an argument is not passed. We can't pass None as the default value in action.yml because it breaks.
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.
Maybe you should try a different way in the action.yml
file. You can test if an environment variable is defined or not directly in the line, and add a piece of text if it is defined. For example:
${VERSION_SCHEMA:+--version-schema $VERSION_SCHEMA}
the :+
part means "if the previous variable is defined, add what is after me". Thus, if VERSION_SCHEMA isn't defined, that will translate to no text, while if it is defined, it will translate to --version-schema $VERSION_SCHEMA
- Add logic to move the YAML file to the specified path in `action.yml`
42ad1ed
to
1411435
Compare
@sergio-costas I often forget to update action.yml because everything works fine during local testing without it. Is there a way to test the workflow directly (instead of locally) to ensure I don’t miss updating action.yml? |
About testing the action.yml... there seems to be "gh", the github-cli program. I think that it allows to do that. |
Refactored |
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.
After the changes, it looks good.
@rudra-iitm Do you have merge permissions...? |
No, I don't have such permissions. |
I'll merge it, then. And thanks for the PR! |
This update introduces a new argument to allow users to specify the file path to the YAML file (snapcraft.yaml or rockcraft.yaml). It ensures the workflow operates seamlessly even when the YAML file is located in a non-conventional directory.
Key Change
--yaml-path
argument to accept the path to the YAML file.Usage
Users can now pass the file path using the
--yaml-path
flag:--yaml-path: 'path/to/yaml/file'
Benefits