#!/usr/bin/env bash
set -euo pipefail
# Requires glab authenticated to gitlab.com. Run once before the scenario.
project_id=$(glab api -X POST projects -f name=pr-47162-proof -f path=pr-47162-proof -f visibility=public -f initialize_with_readme=true | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
glab api -X POST "projects/$project_id/issues" -f title='Fix İstanbul timezone' >/dev/null
glab api -X POST "projects/$project_id/repository/branches" -f branch=change-readme -f ref=main >/dev/null
glab api -X PUT "projects/$project_id/repository/files/README.md" -f branch=change-readme -f content='Proof README change' -f commit_message='Change readme' >/dev/null
glab api -X POST "projects/$project_id/merge_requests" -f source_branch=change-readme -f target_branch=main -f title='Change readme' >/dev/null
# Scenario remote assumes the julius54 account used for this proof.
printf 'Created synthetic project ID: %s\n' "$project_id"
# Cleanup after both runs: glab api -X DELETE "projects/$project_id"
