Skip to content

Commit

Permalink
chore: use input api url (#1293)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user committed Jun 23, 2023
1 parent a553a02 commit a4cd522
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
# Event `push`: Compare the preceding commit -> to the current commit of the main branch.
# Event `pull_request`: Compare the last commit of main -> to the current commit of a Pull Request branch.
# ------------------------------------------------------------------------------------------------------------
job2: # Example 2 - Using local .git history
job2: # Example 2 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
Expand All @@ -141,7 +141,7 @@ jobs:
echo "$file was changed"
done
job3: # Example 3 - Using local .git history
job3: # Example 3 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
Expand All @@ -161,7 +161,7 @@ jobs:
echo "One or more files in the docs folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
job4: # Example 4 - Using local .git history
job4: # Example 4 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
Expand All @@ -184,7 +184,7 @@ jobs:
echo "One or more .js file(s) or any file in the static folder but not in the doc folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-excluded.outputs.all_changed_files }}"
job5: # Example 5 - Using local .git history
job5: # Example 5 - Using local .git directory
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
Expand Down
10 changes: 6 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/changedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ export const getChangedFilesFromGithubAPI = async ({
inputs: Inputs
env: Env
}): Promise<ChangedFiles> => {
const octokit = github.getOctokit(inputs.token)
const octokit = github.getOctokit(inputs.token, {
baseUrl: inputs.apiUrl
})
const changedFiles: ChangedFiles = {
[ChangeTypeEnum.Added]: [],
[ChangeTypeEnum.Copied]: [],
Expand All @@ -283,7 +285,7 @@ export const getChangedFilesFromGithubAPI = async ({
RestEndpointMethodTypes['pulls']['listFiles']['response']['data'][0]
>(options)

core.info(`Got ${paginatedResponse.length} changed files from GitHub API`)
core.info(`Found ${paginatedResponse.length} changed files from GitHub API`)
const statusMap: Record<string, ChangeTypeEnum> = {
added: ChangeTypeEnum.Added,
removed: ChangeTypeEnum.Deleted,
Expand Down
6 changes: 3 additions & 3 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type Inputs = {
recoverDeletedFiles: boolean
recoverDeletedFilesToDestination: string
token: string
api_url: string
apiUrl: string
}

export const getInputs = (): Inputs => {
Expand Down Expand Up @@ -153,7 +153,7 @@ export const getInputs = (): Inputs => {
{required: false}
)
const token = core.getInput('token', {required: false})
const api_url = core.getInput('api_url', {required: false})
const apiUrl = core.getInput('api_url', {required: false})

const inputs: Inputs = {
files,
Expand Down Expand Up @@ -194,7 +194,7 @@ export const getInputs = (): Inputs => {
outputDir,
outputRenamedFilesAsDeletedAndAdded,
token,
api_url
apiUrl
}

if (fetchDepth) {
Expand Down

0 comments on commit a4cd522

Please sign in to comment.