Skip to content

Commit

Permalink
adding whitelisting IP to test-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
brycefrank committed Sep 29, 2024
1 parent 5d83744 commit 5875598
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Get runner IP
run: echo "RUNNER_IP=$(curl ifconfig.me)" >> $GITHUB_ENV
shell: bash

- name: Whitelist IP
env:
MONGO_API_PUBLIC: ${{secrets.MONGO_API_PUBLIC}}
MONGO_API_PRIVATE: ${{secrets.MONGO_API_PRIVATE}}
MONGODB_PROJECT_ID: ${{secrets.MONGODB_PROJECT_ID}}
run: |
curl --location "https://cloud.mongodb.com/api/atlas/v1.0/groups/$MONGODB_PROJECT_ID/accessList" \
--digest -u "$MONGO_API_PUBLIC:$MONGO_API_PRIVATE" \
--header "Content-Type: application/json" \
--data '[
{
"ipAddress": "'$RUNNER_IP'/32",
"comment": "Added via GitHub db-update action"
}
]'
shell: bash

- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
Expand Down Expand Up @@ -48,4 +69,15 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
path: ${{ runner.temp }}/package

- name: Remove IP
env:
MONGO_API_PUBLIC: ${{secrets.MONGO_API_PUBLIC}}
MONGO_API_PRIVATE: ${{secrets.MONGO_API_PRIVATE}}
MONGODB_PROJECT_ID: ${{secrets.MONGODB_PROJECT_ID}}
run: |
curl --request DELETE \
--location "https://cloud.mongodb.com/api/atlas/v1.0/groups/$MONGODB_PROJECT_ID/accessList/${RUNNER_IP}%2F32" \
--digest -u "$MONGO_API_PUBLIC:$MONGO_API_PRIVATE"
shell: bash

0 comments on commit 5875598

Please sign in to comment.