mirror of
https://gitea.com/actions/dorny-paths-filter.git
synced 2026-03-26 06:38:20 +00:00
Compare commits
2 Commits
master
...
git-compat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b46c89ad2 | ||
|
|
08809b8c81 |
10
dist/index.js
vendored
10
dist/index.js
vendored
@@ -363,8 +363,8 @@ exports.listAllFilesAsAdded = listAllFilesAsAdded;
|
||||
async function getCurrentRef() {
|
||||
core.startGroup(`Get current git ref`);
|
||||
try {
|
||||
const branch = (await (0, exec_1.getExecOutput)('git', ['branch', '--show-current'])).stdout.trim();
|
||||
if (branch) {
|
||||
const branch = (await (0, exec_1.getExecOutput)('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim();
|
||||
if (branch && branch !== 'HEAD') {
|
||||
return branch;
|
||||
}
|
||||
const describe = await (0, exec_1.getExecOutput)('git', ['describe', '--tags', '--exact-match'], { ignoreReturnCode: true });
|
||||
@@ -625,7 +625,7 @@ async function getChangedFiles(token, base, ref, initialFetchDepth) {
|
||||
case 'pull_request_review_comment':
|
||||
case 'pull_request_target': {
|
||||
if (ref) {
|
||||
core.warning(`'ref' input parameter is ignored when action is triggered by pull request event`);
|
||||
core.warning(`'ref' input parameter is ignored when 'base' is set to HEAD`);
|
||||
}
|
||||
if (base) {
|
||||
core.warning(`'base' input parameter is ignored when action is triggered by pull request event`);
|
||||
@@ -640,7 +640,7 @@ async function getChangedFiles(token, base, ref, initialFetchDepth) {
|
||||
// At the same time we don't want to fetch any code from forked repository
|
||||
throw new Error(`'token' input parameter is required if action is triggered by 'pull_request_target' event`);
|
||||
}
|
||||
core.info('GitHub token is not available - changes will be detected using git diff');
|
||||
core.info('Github token is not available - changes will be detected using git diff');
|
||||
const baseSha = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.base.sha;
|
||||
const defaultBranch = (_b = github.context.payload.repository) === null || _b === void 0 ? void 0 : _b.default_branch;
|
||||
const currentRef = await git.getCurrentRef();
|
||||
@@ -710,7 +710,7 @@ async function getChangedFilesFromGit(base, head, initialFetchDepth) {
|
||||
}
|
||||
// Uses github REST api to get list of files changed in PR
|
||||
async function getChangedFilesFromApi(token, pullRequest) {
|
||||
core.startGroup(`Fetching list of changed files for PR#${pullRequest.number} from GitHub API`);
|
||||
core.startGroup(`Fetching list of changed files for PR#${pullRequest.number} from Github API`);
|
||||
try {
|
||||
const client = github.getOctokit(token);
|
||||
const per_page = 100;
|
||||
|
||||
@@ -166,8 +166,8 @@ export async function listAllFilesAsAdded(): Promise<File[]> {
|
||||
export async function getCurrentRef(): Promise<string> {
|
||||
core.startGroup(`Get current git ref`)
|
||||
try {
|
||||
const branch = (await getExecOutput('git', ['branch', '--show-current'])).stdout.trim()
|
||||
if (branch) {
|
||||
const branch = (await getExecOutput('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim()
|
||||
if (branch && branch !== 'HEAD') {
|
||||
return branch
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ async function getChangedFiles(token: string, base: string, ref: string, initial
|
||||
case 'pull_request_review_comment':
|
||||
case 'pull_request_target': {
|
||||
if (ref) {
|
||||
core.warning(`'ref' input parameter is ignored when action is triggered by pull request event`)
|
||||
core.warning(`'ref' input parameter is ignored when 'base' is set to HEAD`)
|
||||
}
|
||||
if (base) {
|
||||
core.warning(`'base' input parameter is ignored when action is triggered by pull request event`)
|
||||
@@ -107,7 +107,7 @@ async function getChangedFiles(token: string, base: string, ref: string, initial
|
||||
// At the same time we don't want to fetch any code from forked repository
|
||||
throw new Error(`'token' input parameter is required if action is triggered by 'pull_request_target' event`)
|
||||
}
|
||||
core.info('GitHub token is not available - changes will be detected using git diff')
|
||||
core.info('Github token is not available - changes will be detected using git diff')
|
||||
const baseSha = github.context.payload.pull_request?.base.sha
|
||||
const defaultBranch = github.context.payload.repository?.default_branch
|
||||
const currentRef = await git.getCurrentRef()
|
||||
@@ -194,7 +194,7 @@ async function getChangedFilesFromGit(base: string, head: string, initialFetchDe
|
||||
|
||||
// Uses github REST api to get list of files changed in PR
|
||||
async function getChangedFilesFromApi(token: string, pullRequest: PullRequest): Promise<File[]> {
|
||||
core.startGroup(`Fetching list of changed files for PR#${pullRequest.number} from GitHub API`)
|
||||
core.startGroup(`Fetching list of changed files for PR#${pullRequest.number} from Github API`)
|
||||
try {
|
||||
const client = github.getOctokit(token)
|
||||
const per_page = 100
|
||||
|
||||
Reference in New Issue
Block a user