chore: use input api url (#1293)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
a553a029f5
commit
a4cd522ee2
@ -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:
|
||||
|
10
dist/index.js
generated
vendored
10
dist/index.js
generated
vendored
@ -215,7 +215,9 @@ const getAllChangeTypeFiles = ({ inputs, changedFiles }) => __awaiter(void 0, vo
|
||||
exports.getAllChangeTypeFiles = getAllChangeTypeFiles;
|
||||
const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
var _a, e_1, _b, _c;
|
||||
const octokit = github.getOctokit(inputs.token);
|
||||
const octokit = github.getOctokit(inputs.token, {
|
||||
baseUrl: inputs.apiUrl
|
||||
});
|
||||
const changedFiles = {
|
||||
[ChangeTypeEnum.Added]: [],
|
||||
[ChangeTypeEnum.Copied]: [],
|
||||
@ -234,7 +236,7 @@ const getChangedFilesFromGithubAPI = ({ inputs, env }) => __awaiter(void 0, void
|
||||
per_page: 100
|
||||
});
|
||||
const paginatedResponse = yield octokit.paginate(options);
|
||||
core.info(`Got ${paginatedResponse.length} changed files from GitHub API`);
|
||||
core.info(`Found ${paginatedResponse.length} changed files from GitHub API`);
|
||||
const statusMap = {
|
||||
added: ChangeTypeEnum.Added,
|
||||
removed: ChangeTypeEnum.Deleted,
|
||||
@ -1243,7 +1245,7 @@ const getInputs = () => {
|
||||
});
|
||||
const recoverDeletedFilesToDestination = core.getInput('recover_deleted_files_to_destination', { 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 = {
|
||||
files,
|
||||
filesSeparator,
|
||||
@ -1283,7 +1285,7 @@ const getInputs = () => {
|
||||
outputDir,
|
||||
outputRenamedFilesAsDeletedAndAdded,
|
||||
token,
|
||||
api_url
|
||||
apiUrl
|
||||
};
|
||||
if (fetchDepth) {
|
||||
inputs.fetchDepth = Math.max(parseInt(fetchDepth, 10), 2);
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user