Closed scara closed 3 years ago
Yup, it seems I did screw it a bit while debugging. I am surprised though that it worked for both cases for me ... Let me check it tomorrow with fresh head. Thanks!
OK. Now I can see what mistake I did and why it still worked (or seemed to work).
My original intention was to populate the value of TAGNAME
as either coming from the user input (when the workflow is triggered manually) or from GITHUB_REF
(when the workflow is triggered by pushing a new tag). Then use this value to populate the ZIPURL
and use it as a parameter.
My current script has three bugs actually:
else
branch does ZIPURL="${GITHUB_REF}"
which was meant to be TAGNAME="${GITHUB_REF}"
ZIPURL=
does not use TAGNAME
but always uses the manual inputGITHUB_REF
comes as full ref like ref/heads/tagname
tl;dr: Exactly what @scara correctly reports here :-)
The reason why it still seemed to work was that when you use the URL https://api.github.com/repos/USERNAME/REPONAME/zipball/
without the optional trailing REF part, it uses the head of the default branch - which by co-incidence was the meant tag in my case (https://docs.github.com/en/rest/reference/repos#download-a-repository-archive-zip)
Looking at the submitted pull request now.
Hi @mudrd8mz, thanks for releasing such a great opportunity with both this GH workflow and the new Plugins directory API! š š
I do not try it yet, just looked at the code of the workflow. What is the aim of
TAGNAME
? It looks like being never used. And why defining a default value forZIPURL
? It will be always evaluated regardless being previously defined.Besides
GITHUB_REF
is the "long" branch (or tag) ref e.g.refs/heads/feature-branch-1
which is available even via the contextgithub.ref
.Guessing that if there's no tag name - e.g. some wrong changes in the current triggering schema - , no release should happen into the Moodle Plugin Registry. From my understanding the current setup will be triggered:
v
github.event.inputs.tag
The workflow looks like working properly on just the second triggering event. I'm thinking to propose something like the diff below:
What do you think?
TIA, Matteo