chore: add LICENSE (#24)
#49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Run Go unit & integration tests | |
| run: go test ./... -v | |
| env: | |
| INTEGRATION_TEST: all | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TEST_APP_CLIENT_ID: ${{ vars.TEST_APP_CLIENT_ID }} | |
| TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }} | |
| TEST_APP_INSTALLATION_ID: ${{ vars.TEST_APP_INSTALLATION_ID }} | |
| TEST_APP_OWNER: ${{ github.repository_owner }} | |
| TEST_APP_REPO: ${{ github.event.repository.name }} | |
| - name: Run GitHub Action unit tests | |
| run: cd action && npm ci && npm test | |
| - name: Build GitHub Action | |
| run: cd action && npm run build | |
| - name: Generate STS config | |
| run: | | |
| cat > /tmp/sts-config.yaml <<EOF | |
| audience: "http://localhost:8080" | |
| port: 8080 | |
| allowed_issuers: | |
| - "https://token.actions.githubusercontent.com" | |
| policy_reader_app: | |
| client_id: "${{ vars.TEST_APP_CLIENT_ID }}" | |
| private_key: | |
| env_var: TEST_APP_PRIVATE_KEY | |
| installations: | |
| ${{ github.repository_owner }}: ${{ vars.TEST_APP_INSTALLATION_ID }} | |
| sts_target_apps: | |
| sts-test: | |
| client_id: "${{ vars.TEST_APP_CLIENT_ID }}" | |
| private_key: | |
| env_var: TEST_APP_PRIVATE_KEY | |
| installations: | |
| ${{ github.repository_owner }}: ${{ vars.TEST_APP_INSTALLATION_ID }} | |
| EOF | |
| - name: Start STS server for GitHub Action integration test | |
| run: go run ./cmd/github-app-sts-server/ --config /tmp/sts-config.yaml & | |
| env: | |
| TEST_APP_PRIVATE_KEY: ${{ secrets.TEST_APP_PRIVATE_KEY }} | |
| - name: Wait for STS server | |
| run: timeout 30 bash -c 'until curl -sf http://localhost:8080/ready; do sleep 1; done' | |
| - name: Perform token exchange via GitHub Action | |
| uses: ./action | |
| id: sts | |
| with: | |
| sts-url: http://localhost:8080 | |
| policy: this-policy-is-used-in-integration-tests | |
| target: https://github.com/${{ github.repository }} | |
| - name: Verify exchanged token works | |
| run: gh api repos/${{ github.repository }} | |
| env: | |
| GH_TOKEN: ${{ steps.sts.outputs.token }} |