Use an API call to check for new versions instead of git ls-remote #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using this resource with a webhook trigger, the resource sometimes fails to detect new pull request because Bitbucket calls the webhook URL before creating the refs in the git repository.
Since the resource used
git ls-remote
to check for new PRs, it happens often that the repo is not ready when thecheck
is done, and then no new version is detected and no job is started.This commit change the behavior of the
check
command to use an API call to get the pull requests, which will hopefully be up to date when the webhook calls for the update.Since we don't have access to the
pull-request/<id>/merge
hash from the API, the structure of the version is slightly changed :hash
is replace byfrom_hash
andto_hash
, pointing to the HEAD of the source and target branchesto_hash
is only populated when the source indicates that a new build is to be made when the target change. This ensure that a new version is made only when needed.