From 922ac8b6dbe224c50b1b79387e74a6def9cd63c7 Mon Sep 17 00:00:00 2001 From: Chao Yang Wu Date: Thu, 11 Aug 2022 02:13:16 +0800 Subject: [PATCH] feat: read github api/graphql url from action context (#532) * feat: read github api/graphql url from action context * fix tests Co-authored-by: Jeff Ching --- action.yml | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2536c19..701fc8e 100644 --- a/action.yml +++ b/action.yml @@ -75,11 +75,11 @@ inputs: github-api-url: description: 'configure github API URL. Default `https://api.github.com`' required: false - default: '' + default: ${{ github.api_url }} github-graphql-url: description: 'configure github GraphQL URL. Default `https://api.github.com`' required: false - default: '' + default: ${{ github.graphql_url }} repo-url: description: 'configure github repository URL. Default `process.env.GITHUB_REPOSITORY`' required: false diff --git a/index.js b/index.js index bc50326..0ca70ef 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ function getGitHubInput () { defaultBranch: core.getInput('default-branch') || undefined, repoUrl: core.getInput('repo-url') || process.env.GITHUB_REPOSITORY, apiUrl: core.getInput('github-api-url') || GITHUB_API_URL, - graphqlUrl: core.getInput('github-graphql-url') || GITHUB_GRAPHQL_URL, + graphqlUrl: (core.getInput('github-graphql-url') || '').replace(/\/graphql$/, '') || GITHUB_GRAPHQL_URL, token: core.getInput('token', { required: true }) } }