From eba9d183f05e4dbe442db218cc0d3c42be6bda1e Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Fri, 5 May 2023 15:51:58 -0300 Subject: [PATCH] fix: status checks contexts (#2) --- entrypoint.sh | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d8ed4c2..f5d63e7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -160,22 +160,14 @@ for repository in "${REPOSITORIES[@]}"; do -u ${USERNAME}:${GITHUB_TOKEN} \ --silent \ ${GITHUB_API_URL}/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection - - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -u ${USERNAME}:${GITHUB_TOKEN} \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - --silent \ - https://api.github.com/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/enforce_admins curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -u ${USERNAME}:${GITHUB_TOKEN}\ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/required_status_checks \ - -d '{"strict":true}' + ${GITHUB_API_URL}/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/required_status_checks \ + -d '{"strict":true, "checks": [{"context": "", "app_id": -1}]}' elif [ "$BRANCH_PROTECTION_ENABLED" == "false" ]; then curl \ @@ -186,20 +178,12 @@ for repository in "${REPOSITORIES[@]}"; do --silent \ ${GITHUB_API_URL}/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection - curl -L \ - -X DELETE \ - -H "Accept: application/vnd.github+json" \ - -u ${USERNAME}:${GITHUB_TOKEN} \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - --silent \ - https://api.github.com/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/enforce_admins - curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -u ${USERNAME}:${GITHUB_TOKEN}\ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/required_status_checks + ${GITHUB_API_URL}/repos/${repository}/branches/${BRANCH_PROTECTION_NAME}/protection/required_status_checks fi