rseng / zenodo-release

Automated releases to zenodo without granting admin access to webhooks
MIT License
10 stars 4 forks source link

zip files not being uploaded #11

Closed eeholmes closed 9 months ago

eeholmes commented 9 months ago

Hi,

I am trying to get your GA working as I do not have permission to add the Zenodo 3rd app on my work GitHub. Test repo: https://github.com/Rgovys/test-integration

I am able to get your GA working, and it uploads a new release but the zip file is not uploading. There are no obvious errors in the GA. I am not sure how to debug. The Zenodo token has both deposit checkboxes checked.

image

Thanks for any help.

eeholmes commented 9 months ago

Here you see no files:

image

This is what I expect (from earlier test using the Zenodo integration)

image
vsoch commented 9 months ago

It's because (I think) you are giving it an archive called "test11" see:

python /home/runner/work/_actions/rseng/zenodo-release/main/scripts/deploy.py upload ${archive} --version ${version}"
python /home/runner/work/_actions/rseng/zenodo-release/main/scripts/deploy.py upload test11 --version test11 --doi 10.5281/zenodo.10719406

My guess would be that it's expecting something with an archive extension to know to unwrap it. Try doing some print statements to check the name of ${archive} before you send it up, ensure it's actually an archive, and check the content type with file. That would be the first thing to try.

eeholmes commented 9 months ago

Yes that's what's going on (sort of). The zip file is uploaded but because it didn't have .tar file ending, it wasn't being recognized as a tar file when I downloaded. I think I need to add ".tar" to the script and probably add some decoration to the filename like user/repo-tag like the Zenodo GitHub integration.

Thanks for the code btw. This is a big help while we see if our work GitHub will allow us to give 3rd party OAuth access to Zenodo.

vsoch commented 9 months ago

Awesome! So it worked, is this the upload? https://zenodo.org/records/10719852

eeholmes-uw commented 9 months ago

This is the upload: https://zenodo.org/records/10725222

There are a few things I need to fix in my GitHub Action. First I think I need to upload a zip file instead of tar so that Zenodo can do a preview like this. So I just tacked on .tar which is probably not right anyhow and I need to convert the tarball to zip although perhaps I will try .tar.gz and see if Zenodo preview that. https://github.com/Rgovys/test-integration/blob/c28026e1f39c05d9ab0a6e6b594b60bfa1b9b23a/.github/workflows/zenodo.yml#L16C1-L19C46

This is the preview shown when a zip file is uploaded

image

I haven't decided if I want to add a function to have the metadata (.zenodo.json) autogenerated from the GitHub API, like the Zenodo integration does. That metadata is often a bit off. On the other hand getting people to create a .zenodo.json file might have low success.

I am creating a Zenodo GitHub Action that can be deployed across our GH orgs that will not allow admin to webhooks by 3rd party apps. I am really frustrated that Zenodo developers did not implement a token option. The webhook that their app creates is simple. It would be no problem for our code developers to put that on their repos. But Zenodo's web hook a) has a 'secret' that you can't see, b) your public GH repo has to be linked (or synced) to Zenodo on their side and that linking requires the org (and you in your personal account) to give admin access to webhooks across the org (??), and b) there is no info that I could find on the Zenodo GitHub API, the https://zenodo.org/api/hooks/receivers/github/events/ api.

vsoch commented 9 months ago

which is probably not right anyhow and I need to convert the tarball to zip although perhaps I will try .tar.gz and see if Zenodo preview that.

Yes the desired format is typically the compressed archive. Feel free to close the issue when there aren't explicitly more problems with the action. Ty!

eeholmes commented 9 months ago

Closing. I will post a PR of the change I make in the example GA that is in the Readme in case you want to use that. Affects this line https://github.com/Rgovys/test-integration/blob/c28026e1f39c05d9ab0a6e6b594b60bfa1b9b23a/.github/workflows/zenodo.yml#L16C1-L19C46

So that Zenodo shows the zip preview.

eeholmes-uw commented 9 months ago

Got it working and solution was simple. Needed to use the zipball instead of the tarball

    - name: download archive to runner
      env:
        zipball: ${{ github.event.release.zipball_url }}
      run: |
        name=$(basename ${zipball}).zip   
        curl -L $zipball > $name
        echo "archive=${name}" >> $GITHUB_ENV
image
eeholmes-uw commented 9 months ago

BTW I wanted the description to be from the release notes to mimic the Zenodo integration behavior. The hard part was getting the release notes to be formatted as I didn't realize that Zenodo wants html. Once I use converted the raw json text (markdown) to html it worked nicely.

My fork is here https://github.com/nmfs-opensci/zenodo-release/tree/main but the commit history is a mess and I need to squash it.

image
vsoch commented 9 months ago

Cool! If you put together a PR that you like please contribute back to the upstream here, and I can give feedback for the details of the implementation - future others might want to do the same!

eeholmes commented 9 months ago

Will do. I need to do a bit more clean-up and will put in separate PRs for the different types of changes I did to make it easier to pick and choose what changes, if any, you want to incorporate.