This PR switches proxy support to Node's native env-proxy handling and makes the required configuration explicit. ## What changed - fail fast in both `main` and `post` when proxy configuration is present without `NODE_USE_ENV_PROXY=1` - document the supported proxy configuration in `README.md` - add regression tests for the proxy guard in both entrypoints - keep the existing successful end-to-end coverage and add a smaller proxy-specific workflow check that enables native proxy support, points `https_proxy` at an unreachable proxy, and asserts the action fails - update the test workflow so the same checks also run on pushes to `beta` ## Proxy configuration When using `HTTP_PROXY` or `HTTPS_PROXY`, set `NODE_USE_ENV_PROXY=1` on the action step. If you need bypass rules, set `NO_PROXY` alongside them. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
83 lines
2.3 KiB
YAML
83 lines
2.3 KiB
YAML
name: test
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- main
|
||
- beta
|
||
pull_request:
|
||
workflow_dispatch:
|
||
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
jobs:
|
||
integration:
|
||
name: Integration
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v5
|
||
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: package.json
|
||
cache: 'npm'
|
||
|
||
- run: npm ci
|
||
- run: npm test
|
||
|
||
end-to-end:
|
||
name: End-to-End
|
||
runs-on: ubuntu-latest
|
||
# do not run from forks, as forks don’t have access to repository secrets
|
||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
|
||
steps:
|
||
- uses: actions/checkout@v5
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: package.json
|
||
cache: 'npm'
|
||
- run: npm ci
|
||
- run: npm run build
|
||
- uses: ./ # Uses the action in the root directory
|
||
id: test
|
||
with:
|
||
app-id: ${{ vars.TEST_APP_ID }}
|
||
private-key: ${{ secrets.TEST_APP_PRIVATE_KEY }}
|
||
- uses: octokit/request-action@v2.x
|
||
id: get-repository
|
||
env:
|
||
GITHUB_TOKEN: ${{ steps.test.outputs.token }}
|
||
with:
|
||
route: GET /installation/repositories
|
||
- run: echo '${{ steps.get-repository.outputs.data }}'
|
||
|
||
end-to-end-proxy:
|
||
name: End-to-End with unreachable proxy
|
||
runs-on: ubuntu-latest
|
||
# do not run from forks, as forks don’t have access to repository secrets
|
||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
|
||
steps:
|
||
- uses: actions/checkout@v5
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version-file: package.json
|
||
cache: 'npm'
|
||
- run: npm ci
|
||
- run: npm run build
|
||
- uses: ./ # Uses the action in the root directory
|
||
continue-on-error: true
|
||
id: test
|
||
env:
|
||
NODE_USE_ENV_PROXY: "1"
|
||
https_proxy: http://127.0.0.1:9
|
||
with:
|
||
app-id: ${{ vars.TEST_APP_ID }}
|
||
private-key: ${{ secrets.TEST_APP_PRIVATE_KEY }}
|
||
- name: Assert action failed through unreachable proxy
|
||
run: test "${{ steps.test.outcome }}" = "failure"
|