GH

fetch repository_id

gh api -H "Accept: application/vnd.github+json" repos/ORG/REPO | jq .id

getch owner_id

gh api -H "Accept: application/vnd.github+json" repos/ORG/REPO | jq .owner.id

update oidc claims

gh api \
  --method PUT \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/ORG/REPO/actions/oidc/customization/sub \
   -F "use_default=false" -f "include_claim_keys[]=repo" -f "include_claim_keys[]=ref"

configure secrets

gh secret set KEY --env ${ENV}

update env

gh api \
  --method PUT \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/ORG/REPO/environments/${ENV} \
   -F "wait_timer=30" -F "prevent_self_review=false" -f "reviewers[][type]=User" -F "reviewers[][id]=1" -f "reviewers[][type]=Team" -F "reviewers[][id]=1" -F "deployment_branch_policy[protected_branches]=false" -F "deployment_branch_policy[custom_branch_policies]=true"

check permissions on repo

gh api repos/ORG/REPO/collaborators/${USERNAME}/permission

REFERENCES