-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: do not fail on already existing rocks, add fail_on_duplicate
flag
#411
Conversation
88fca8a
to
9303022
Compare
Pull request is ready now. Let me know if I missed something critical or obvious :) |
https://github.com/nvim-neorg/neorg/actions/runs/9211062730/job/25339613079 hmm, weird? 🤔 Very difficult to assess the source of the error here |
|
Hah that much I could see, I meant the source of why the fallback mechanism doesn't seem to be triggering properly at all. I can't see the search command being executed in the verbose logs (even though it should). |
lua/luarocks-tag-release.lua
Outdated
local stdout, _ = OS.execute(cmd, function(message) | ||
if message:find("already exists on the server") and not args.fail_on_duplicate then | ||
print( | ||
string.format( | ||
'%s already exists with version %s on the remote. Doing nothing (`fail_on_duplicate` is false).' | ||
) | ||
) | ||
else | ||
error(message) | ||
end | ||
end, args.is_debug) |
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.
Do let me know if it's more in your style to break this out into a separate function :)
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'm fine with this as it is.
Tested over at https://github.com/nvim-neorg/neorg/actions/runs/9237717985/job/25415443099 and it seems to be functional :) |
@@ -92,7 +93,19 @@ local function luarocks_tag_release(package_name, package_version, specrev, args | |||
.. ' --api-key $LUAROCKS_API_KEY' | |||
.. luarocks_extra_flags_and_args | |||
print('UPLOAD: ' .. cmd) | |||
local stdout, _ = OS.execute(cmd, error, args.is_debug) | |||
local stdout, _ = OS.execute(cmd, function(message) | |||
if message:find('already exists on the server') and not args.fail_on_duplicate then |
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.
suggestion: we should probably add an integration test for this (a workflow that uploads luarocks-tag-release with a hardcoded version), just in case the error message changes after a luarocks update.
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.
That's a good idea, I like that. Shall we do that in a separate PR or in 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.
I'm fine with creating an issue for it and merging this one.
This pull request adds a
fail_on_duplicate
flag to the github action (set tofalse
by default). This will prevent the workflow from failing if the rock already exists on the server.This should greatly simplify the workflows people use for releasing their plugin, as now the workflow should be able to run every time a commit is made to a repository.
Fixes #377.
Things to do: