@@ -248,3 +248,78 @@ jobs:
248
248
done <<< "$tests"
249
249
250
250
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY
251
+
252
+ test-base-url :
253
+ name : ' Integration test: base-url option'
254
+ runs-on : ubuntu-latest
255
+ steps :
256
+ - uses : actions/checkout@v3
257
+ - uses : ./.github/actions/install-dependencies
258
+
259
+ - id : base-url-default
260
+ name : API URL with base-url not set
261
+ uses : ./
262
+ with :
263
+ script : |
264
+ const endpoint = github.request.endpoint
265
+ return endpoint({}).url
266
+ result-encoding : string
267
+
268
+ - id : base-url-default-graphql
269
+ name : GraphQL URL with base-url not set
270
+ uses : ./
271
+ with :
272
+ script : |
273
+ const endpoint = github.request.endpoint
274
+ return endpoint({url: "/graphql"}).url
275
+ result-encoding : string
276
+
277
+ - id : base-url-set
278
+ name : API URL with base-url set
279
+ uses : ./
280
+ with :
281
+ base-url : https://my.github-enterprise-server.com/api/v3
282
+ script : |
283
+ const endpoint = github.request.endpoint
284
+ return endpoint({}).url
285
+ result-encoding : string
286
+
287
+ - id : base-url-set-graphql
288
+ name : GraphQL URL with base-url set
289
+ uses : ./
290
+ with :
291
+ base-url : https://my.github-enterprise-server.com/api/v3
292
+ script : |
293
+ const endpoint = github.request.endpoint
294
+ return endpoint({url: "/graphql"}).url
295
+ result-encoding : string
296
+
297
+ - run : |
298
+ echo "- Validating API URL default"
299
+ expected="https://api.github.com/"
300
+ actual="${{steps.base-url-default.outputs.result}}"
301
+ if [[ "$expected" != "$actual" ]]; then
302
+ echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
303
+ exit 1
304
+ fi
305
+ echo "- Validating GraphQL URL default"
306
+ expected="https://api.github.com/graphql"
307
+ actual="${{steps.base-url-default-graphql.outputs.result}}"
308
+ if [[ "$expected" != "$actual" ]]; then
309
+ echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
310
+ exit 1
311
+ fi
312
+ echo "- Validating base-url set to a value"
313
+ expected="https://my.github-enterprise-server.com/api/v3/"
314
+ actual="${{steps.base-url-set.outputs.result}}"
315
+ if [[ "$expected" != "$actual" ]]; then
316
+ echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
317
+ exit 1
318
+ fi
319
+ echo "- Validating GraphQL URL with base-url set to a value"
320
+ expected="https://my.github-enterprise-server.com/api/v3/graphql"
321
+ actual="${{steps.base-url-set-graphql.outputs.result}}"
322
+ if [[ "$expected" != "$actual" ]]; then
323
+ echo $'::error::\u274C' "Expected base-url to equal '$expected', got $actual"
324
+ exit 1
325
+ fi
0 commit comments