diff --git a/.azure-pipelines/update-refdata.yml b/.azure-pipelines/update-refdata.yml index 7c395b214e0..a9a4cf0af01 100644 --- a/.azure-pipelines/update-refdata.yml +++ b/.azure-pipelines/update-refdata.yml @@ -34,7 +34,7 @@ jobs: - bash: | cd $(refdata.dir) git remote add fork https://$(bot_token)@github.com/tardis-bot/tardis-refdata - git checkout -b pr-$(pr.number) + git checkout -B pr-$(pr.number) displayName: 'Set up new branch' - bash: | @@ -49,11 +49,19 @@ jobs: git config --local user.email "tardis.sn.bot@gmail.com" git config --local user.name "tardis-bot" git commit -m "Automated Update (PR $(pr.number))" - git push fork pr-$(pr.number) + git push fork pr-$(pr.number) -f displayName: 'Commit new reference data' - bash: | cd $(refdata.dir) - echo "$(bot_token)" | gh auth login --with-token - gh pr create --repo tardis-sn/tardis-refdata --head tardis-bot:pr-$(pr.number) --title "Automated Update (PR $(pr.number))" --body "_Pull request automatically generated by [#$(pr.number)](https://github.com/tardis-sn/tardis/pull/$(pr.number))_" + STATE=$(gh pr list --repo tardis-sn/tardis-refdata -H pr-$(pr.number) --json state | jq -r .[].state) + if [[ -z "$STATE" ]]; then + + echo "$(bot_token)" | gh auth login --with-token + gh pr create --repo tardis-sn/tardis-refdata --head tardis-bot:pr-$(pr.number) --title "Automated Update (PR $(pr.number))" --body "_Pull request automatically generated by [#$(pr.number)](https://github.com/tardis-sn/tardis/pull/$(pr.number))_" + + else + exit 0 + + fi displayName: 'Propose changes via pull request'