3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-16 09:27:57 +00:00

chore: use input api url (#1293)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-06-23 12:55:55 -06:00 committed by GitHub
parent a553a029f5
commit a4cd522ee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 9 deletions

View file

@ -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:
@ -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:
@ -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:
@ -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:

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View file

@ -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]: [],
@ -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,

View file

@ -39,7 +39,7 @@ export type Inputs = {
recoverDeletedFiles: boolean
recoverDeletedFilesToDestination: string
token: string
api_url: string
apiUrl: string
}
export const getInputs = (): Inputs => {
@ -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,
@ -194,7 +194,7 @@ export const getInputs = (): Inputs => {
outputDir,
outputRenamedFilesAsDeletedAndAdded,
token,
api_url
apiUrl
}
if (fetchDepth) {