On push action triggered before master.zip is updated

Here’s my project and gh action which prepares and pushed changes to AUR repo: https://github.com/olegantonyan/mpz/blob/31ecb2618213444ed3eb81751661f3f30f4b9963/.github/workflows/release-aur-package.yml

The script itself (https://github.com/olegantonyan/mpz/blob/31ecb2618213444ed3eb81751661f3f30f4b9963/.github/release-aur-github-action.rb) needs to download source tarball (master.zip) and calculate its sha256sum. The problem is that master.zip is not updated immediately after push, but action is triggered right away. Because of that there’s a chance of getting old master.zip archive.

To fix this I had to put sleep step before running the action. I don’t mind having a short delay, but the exact time is completely arbitrary and this is error prone. Is there a better way to check if master.zip was updated already? Or even better run action on push but after master.zip is updated.

Would it be an option to download the commit-specific archive instead of relying on the branch? Something like

source = 'https://github.com/olegantonyan/mpz/archive/%s.zip' % ENV['GITHUB_SHA']

should work. I don’t know exactly when that archive will be available relative to the workflow starting, but at least if it’s not ready yet you should get an HTTP error and could do a wait loop or something.

Yeah, good idea. I can use link to specific commit.zip as a source. Thanks!

1 Like