Skip to content

Commit

Permalink
Update add-checks.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Rakshith B <[email protected]>
  • Loading branch information
Rakshithb1 authored Jan 12, 2024
1 parent 1bec392 commit 70a8540
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/add-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Create branch protection
run: |
BRANCH_NAME="develop"
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
# Get the repository information
REPO_OWNER="Rakshithb1"
REPO_NAME="commons"

# Create a branch protection rule using GitHub API
curl -X PUT \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/branches/$BRANCH_NAME/protection" \
-d '{
"required_status_checks": {
"enforcement_level": "strict",
"contexts": ["kernel-idgenerator-service / build-dockers"]
}
}'

- name: Add branch protection rule
run: |
curl -X POST \
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Authorization: Bearer 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" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/Rakshithb1/commons/branches/develop/protection/required_status_checks/contexts \
-d '{"contexts":["kernel-idgenerator-service / build-dockers","kernel-notification-service / build-dockers"]}'
https://api.github.com/repos/Rakshithb1/commons/branches/develop/protection/required_status_checks

0 comments on commit 70a8540

Please sign in to comment.