Skip to content

Commit

Permalink
Merge pull request #976 from PokeAPI/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Naramsim authored Dec 15, 2023
2 parents 3bb4692 + 0fccf81 commit f9225dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Resources/scripts/updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ configure_git() {
pr_input_updater_start() {
cat <<EOF
{
"body": "A [PokeAPI/api-data](${data_repo_url}) refresh has started. In 45 minutes the staging branch of [PokeAPI/api-data](${data_repo_url}/tree/staging) will be pushed with the new generated data. <br><br> The staging branch will be deployed in our [staging environment]($staging_environment_url) and you will be able to review the entire API. <br><br> A Pull Request ([master](${data_repo_url}/tree/master)<-[staging](${data_repo_url}/tree/staging)) will be also created at [PokeAPI/api-data](${data_repo_url}/pulls) and assigned to the PokeAPI Core team to be reviewed. If approved and merged new data will soon be available worldwide at [pokeapi.co]($production_environment_url)."
"body": "A [PokeAPI/api-data](${data_repo_url}) refresh has started. In ~45 minutes the staging branch of [PokeAPI/api-data](${data_repo_url}/tree/staging) will be pushed with the new generated data. <br><br> The staging branch will be deployed in our [staging environment]($staging_environment_url) and the entire API will be ready to review. <br><br> A Pull Request ([master](${data_repo_url}/tree/master)<-[staging](${data_repo_url}/tree/staging)) will be also created at [PokeAPI/api-data](${data_repo_url}/pulls) and assigned to the PokeAPI Core team to be reviewed. If approved and merged new data will soon be available worldwide at [pokeapi.co]($production_environment_url)."
}
EOF
}

pr_input_updater_end_success() {
cat <<EOF
{
"body": "The updater script has finished its job and has now opened a Pull Request towards [PokeAPI/api-data](${data_repo_url}/pulls) with the updated data. <br><br> You can see the Pull Request deployed at our [staging environment]($staging_environment_url) when [CircleCI deploy]($deploy_circleci_status_url) will be finished (_check the started time of the last build_)."
"body": "The updater script has finished its job and has now opened a Pull Request towards [PokeAPI/api-data](${data_repo_url}/pulls) with the updated data. <br><br> The Pull Request can be seen deployed in our [staging environment]($staging_environment_url) when [CircleCI deploy]($deploy_circleci_status_url) will be finished (_check the start time of the last build_)."
}
EOF
}
Expand Down Expand Up @@ -165,6 +165,7 @@ notify_engine_pr() {

# Run the updater script (https://github.com/PokeAPI/api-data/blob/master/updater/cmd.bash) which will generate the new pokeapi data and push it to the api-data repository under a new branch
run_updater() {
engine_repo_pr_number=$(get_invokator_pr_number)
cd "$data_repo/updater" || cleanexit 'fail' "Failed to cd"
# Wait to be sure PokeAPI/pokeapi's master branch has been updated on Github with the lastest merged PR content
sleep 10
Expand All @@ -177,7 +178,7 @@ run_updater() {

# Run the updater
docker network create pokeapi
docker run --privileged --network pokeapi --network-alias docker -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e COMMIT_MESSAGE="[Updater Bot] Regenerate data from https://github.com/$org/$engine_repo/pull/$(get_invokator_pr_number)" -e COMMIT_AND_PUSH='true' -e RUN_AS='root' pokeapi-updater
docker run --privileged --network pokeapi --network-alias docker -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e COMMIT_MESSAGE="[Updater Bot] Regenerate data from https://github.com/$org/$engine_repo/pull/$engine_repo_pr_number" -e COMMIT_AND_PUSH='true' -e RUN_AS='root' pokeapi-updater
return_code=$?
if [ "$return_code" -eq 2 ]; then
cleanexit 'no-new-data' "Generated data is the same as old data, skipping deploy"
Expand Down

0 comments on commit f9225dc

Please sign in to comment.