Skip to content

Commit

Permalink
fix: status checks contexts (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pehesi97 authored May 5, 2023
1 parent c831a83 commit eba9d18
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

Expand Down

0 comments on commit eba9d18

Please sign in to comment.