From 420ee2daf0419cfc32eaf363600f3144fe70b851 Mon Sep 17 00:00:00 2001 From: goatwu1993 Date: Tue, 19 Jul 2022 12:02:37 +0800 Subject: [PATCH 1/2] feat: read github api/graphql url from action context --- action.yml | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index e014a32b..e89aa171 100644 --- a/action.yml +++ b/action.yml @@ -71,11 +71,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 f9761be6..893379cf 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 }) } } From 85114c9bfd1abcf9271fdea8c0a5762c42c6489a Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 10 Aug 2022 11:10:51 -0700 Subject: [PATCH 2/2] fix tests --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 72bc4f61..0ca70ef1 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').replace(/\/graphql$/, '') || GITHUB_GRAPHQL_URL, + graphqlUrl: (core.getInput('github-graphql-url') || '').replace(/\/graphql$/, '') || GITHUB_GRAPHQL_URL, token: core.getInput('token', { required: true }) } }