glotaran / pyglotaran-examples

This repository hold examples showcasing the use of the pyglotaran package
MIT License
5 stars 7 forks source link

🩹Fix action #14

Closed s-weigand closed 3 years ago

s-weigand commented 3 years ago

The action added by #13 did only properly work with workflow_dispatch but failed with push and pull_request events. The reason for this was that github.event.inputs.pyglotaran_examples_branch was only set on workflow_dispatch and other events didn't use its default. This is why

git clone --depth 1 -b ${{ inputs.examples_branch }} https://github.com/glotaran/pyglotaran-examples.git

evaluated to

git clone --depth 1 -b https://github.com/glotaran/pyglotaran-examples.git

and git did throw an error because there wasn't a repo to clone provided.

Now the action checks that either inputs.examples_branch is provided or that a folder pyglotaran-examples exists. If none of those conditions are met it raises an error explaining whats needs to be done.

The workflow now clones pyglotaran-examples if it is run on push or pull_request, that way pushes and PRs will use the correct commits instead of cloning code already on glotaran/pyglotaran-examples.

The CI will fail on this PR since it uses the action on main which still has the bug. Examples of the 3 different trigger events can be found here:

lgtm-com[bot] commented 3 years ago

This pull request fixes 1 alert when merging ada351892be3f77031c73d06cd514e7bd1fce3e3 into 0fbe291cb730c660de8601357961d35a050fc807 - view on LGTM.com

fixed alerts: