mirror of
https://github.com/actions/github-script.git
synced 2026-02-07 19:47:26 +00:00
Include GraphQL URL validations
This commit is contained in:
parent
98dabfb42f
commit
ec76ce579c
1 changed files with 74 additions and 11 deletions
85
.github/workflows/integration.yml
vendored
85
.github/workflows/integration.yml
vendored
|
|
@ -255,16 +255,27 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/install-dependencies
|
||||
|
||||
- id: base-url-default
|
||||
name: Default base-url not set
|
||||
name: API URL with base-url not set
|
||||
uses: ./
|
||||
with:
|
||||
script: |
|
||||
const endpoint = github.request.endpoint
|
||||
return endpoint({}).url
|
||||
result-encoding: string
|
||||
|
||||
- id: base-url-default-graphql
|
||||
name: GraphQL URL with base-url not set
|
||||
uses: ./
|
||||
with:
|
||||
script: |
|
||||
const endpoint = github.request.endpoint
|
||||
return endpoint({url: "/graphql"}).url
|
||||
result-encoding: string
|
||||
|
||||
- id: base-url-set
|
||||
name: base-url set
|
||||
name: API URL with base-url set
|
||||
uses: ./
|
||||
with:
|
||||
base-url: https://my.github-enterprise-server.com/api/v3
|
||||
|
|
@ -272,8 +283,19 @@ jobs:
|
|||
const endpoint = github.request.endpoint
|
||||
return endpoint({}).url
|
||||
result-encoding: string
|
||||
|
||||
- id: base-url-set-graphql
|
||||
name: GraphQL URL with base-url set
|
||||
uses: ./
|
||||
with:
|
||||
base-url: https://my.github-enterprise-server.com/api/v3
|
||||
script: |
|
||||
const endpoint = github.request.endpoint
|
||||
return endpoint({url: "/graphql"}).url
|
||||
result-encoding: string
|
||||
|
||||
- id: base-url-env
|
||||
name: base-url does not override GITHUB_API_URL when not set
|
||||
name: base-url does not override API URL when not set
|
||||
uses: ./
|
||||
env:
|
||||
GITHUB_API_URL: https://my.github-enterprise-server.com/api/v3
|
||||
|
|
@ -282,22 +304,63 @@ jobs:
|
|||
const endpoint = github.request.endpoint
|
||||
return endpoint({}).url
|
||||
result-encoding: string
|
||||
|
||||
- id: base-url-env-graphql
|
||||
name: base-url does not override GraphQL URL when not set
|
||||
uses: ./
|
||||
env:
|
||||
GITHUB_API_URL: https://my.github-enterprise-server.com/api/v3
|
||||
with:
|
||||
script: |
|
||||
const endpoint = github.request.endpoint
|
||||
return endpoint({url: "/graphql"}).url
|
||||
result-encoding: string
|
||||
|
||||
- run: |
|
||||
echo "- Validating base-url default"
|
||||
echo "- Validating API URL default"
|
||||
expected="https://api.github.com/"
|
||||
if [[ "${{steps.base-url-default.outputs.result}}" != "$expected" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got ${{steps.base-url-default.outputs.result}}"
|
||||
actual="${{steps.base-url-default.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "- Validating GraphQL URL default"
|
||||
expected="https://api.github.com/graphql"
|
||||
actual="${{steps.base-url-default-graphql.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "- Validating base-url set to a value"
|
||||
expected="https://my.github-enterprise-server.com/api/v3/"
|
||||
if [[ "${{steps.base-url-set.outputs.result}}" != "$expected" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got ${{steps.base-url-set.outputs.result}}"
|
||||
actual="${{steps.base-url-set.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
echo "- Validating base-url not set respects GITHUB_API_URL"
|
||||
|
||||
echo "- Validating GraphQL URL with base-url set to a value"
|
||||
expected="https://my.github-enterprise-server.com/api/v3/graphql"
|
||||
actual="${{steps.base-url-set-graphql.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "- Validating API URL with base-url not set respects GITHUB_API_URL"
|
||||
expected="https://my.github-enterprise-server.com/api/v3/"
|
||||
if [[ "${{steps.base-url-env.outputs.result}}" != "$expected" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got ${{steps.base-url-env.outputs.result}}"
|
||||
actual="${{steps.base-url-env.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "- Validating GraphQL URL with base-url not set respects GITHUB_API_URL"
|
||||
expected="https://my.github-enterprise-server.com/api/v3/graphql"
|
||||
actual="${{steps.base-url-env-graphql.outputs.result}}"
|
||||
if [[ "$expected" != "$actual" ]]; then
|
||||
echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue