diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ff1d027 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,46 @@ +name: tests +on: + workflow_dispatch: + push: +jobs: + test: + runs-on: ubuntu-latest + env: + BATON_API_TOKEN: ${{ secrets.BATON_API_TOKEN }} + BATON_SUBDOMAIN: ${{ secrets.BATON_SUBDOMAIN }} + BATON_EMAIL: ${{ secrets.BATON_EMAIL }} + BATON_LOG_LEVEL: 'debug' + # Revoke grants variable + REVOKE_GRANT: 'group:22940582375835:member:team_member:22940899051931' + # Grant entitlements variables + GRANT_ENTITLEMENT: 'group:22940582375835:member' + GRANT_PRINCIPAL: '22940899051931' + GRANT_PRINCIPAL_TYPE: 'team_member' + + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: 1.20.x + - name: Checkout code + uses: actions/checkout@v3 + - name: Build baton-zendesk + run: go build ./cmd/baton-zendesk + - name: Run baton-zendesk-cmd + run: ./baton-zendesk + - name: Revoke grants + if: ${{ env.REVOKE_GRANT }} != '' + run: | + echo "Syncing resources..." + ./baton-zendesk + echo "Testing revoking" + ./baton-zendesk --log-level=debug --revoke-grant ${{ env.REVOKE_GRANT }} + - name: Grant entitlements + if: ${{ env.GRANT_ENTITLEMENT }} != '' && ${{ env.GRANT_PRINCIPAL }} != '' && ${{ env.GRANT_PRINCIPAL_TYPE }} != '' + run: | + echo "Syncing resources..." + ./baton-zendesk + echo "Testing provisioning" + ./baton-zendesk --log-level=debug --grant-entitlement ${{ env.GRANT_ENTITLEMENT }} --grant-principal ${{ env.GRANT_PRINCIPAL }} --grant-principal-type ${{ env.GRANT_PRINCIPAL_TYPE }} + - name: List Resources + run: docker run --rm -v $(pwd):/out ghcr.io/conductorone/baton:latest -f "/out/sync.c1z" resources \ No newline at end of file