mirror of
https://gitea.com/actions/dorny-paths-filter.git
synced 2025-12-26 00:48:20 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebc4d7e9eb | ||
|
|
45f16f1875 | ||
|
|
5da0e4c086 | ||
|
|
1441771bbf | ||
|
|
245527a2ef | ||
|
|
5266f0ac59 |
@@ -1,7 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## v3.0.1
|
||||
- [Compare base and ref when token is empty](https://github.com/dorny/paths-filter/pull/133)
|
||||
|
||||
## v3.0.0
|
||||
- [Update to Node.js 20 ](https://github.com/dorny/paths-filter/pull/210)
|
||||
- [Update to Node.js 20](https://github.com/dorny/paths-filter/pull/210)
|
||||
- [Update all dependencies](https://github.com/dorny/paths-filter/pull/215)
|
||||
|
||||
## v2.11.1
|
||||
|
||||
@@ -72,6 +72,7 @@ For more scenarios see [examples](#examples) section.
|
||||
|
||||
## What's New
|
||||
|
||||
- New major release `v3` after update to Node 20 [Breaking change]
|
||||
- Add `ref` input parameter
|
||||
- Add `list-files: csv` format
|
||||
- Configure matrix job to run for each folder with changes using `changes` output
|
||||
|
||||
8
dist/index.js
vendored
8
dist/index.js
vendored
@@ -555,6 +555,7 @@ function getConfigFileContent(configPath) {
|
||||
return fs.readFileSync(configPath, { encoding: 'utf8' });
|
||||
}
|
||||
async function getChangedFiles(token, base, ref, initialFetchDepth) {
|
||||
var _a, _b;
|
||||
// if base is 'HEAD' only local uncommitted changes will be detected
|
||||
// This is the simplest case as we don't need to fetch more commits or evaluate current/before refs
|
||||
if (base === git.HEAD) {
|
||||
@@ -581,8 +582,11 @@ 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 from PRs merge commit');
|
||||
return await git.getChangesInLastCommit();
|
||||
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();
|
||||
return await git.getChanges(base || baseSha || defaultBranch, currentRef);
|
||||
}
|
||||
else {
|
||||
return getChangedFilesFromGit(base, ref, initialFetchDepth);
|
||||
|
||||
@@ -86,8 +86,11 @@ 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 from PRs merge commit')
|
||||
return await git.getChangesInLastCommit()
|
||||
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()
|
||||
return await git.getChanges(base || baseSha || defaultBranch, currentRef)
|
||||
} else {
|
||||
return getChangedFilesFromGit(base, ref, initialFetchDepth)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user