3 Commits

Author SHA1 Message Date
Michal Dorner
3b817c9974 Add support for pull_request_target (#30)
Complements previous commit:
 - adds modified index.js
 - bumps version to 2.2.1
2020-08-13 21:55:56 +02:00
Rob Dodson
b365bd8768 Update main.ts (#29)
Add support for the new `pull_request_target` event.
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target
2020-08-13 21:44:57 +02:00
Daksh Shah
e1ae9889cb Fix multiple jobs workflow example (#25) 2020-07-16 12:33:30 +02:00
4 changed files with 9 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
# Changelog
## v2.2.1
- [Add support for pull_request_target](https://github.com/dorny/paths-filter/pull/29)
## v2.2.0
- [Improve change detection for feature branches](https://github.com/dorny/paths-filter/pull/16)

View File

@@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2.2.0
- uses: dorny/paths-filter@v2.2.1
id: filter
with:
# inline YAML or path to separate file (e.g.: .github/filters.yaml)
@@ -100,16 +100,18 @@ jobs:
frontend: ${{ steps.filter.outputs.frontend }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2.2.0
- uses: dorny/paths-filter@v2.2.1
id: filter
with:
# Filters stored in own yaml file
filters: '.github/filters.yml'
backend:
needs: changes
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- ...
frontend:
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
steps:
- ...

2
dist/index.js vendored
View File

@@ -4538,7 +4538,7 @@ function getConfigFileContent(configPath) {
}
function getChangedFiles(token) {
return __awaiter(this, void 0, void 0, function* () {
if (github.context.eventName === 'pull_request') {
if (github.context.eventName === 'pull_request' || github.context.eventName === 'pull_request_target') {
const pr = github.context.payload.pull_request;
return token ? yield getChangedFilesFromApi(token, pr) : yield getChangedFilesFromGit(pr.base.sha);
}

View File

@@ -49,7 +49,7 @@ function getConfigFileContent(configPath: string): string {
}
async function getChangedFiles(token: string): Promise<string[] | null> {
if (github.context.eventName === 'pull_request') {
if (github.context.eventName === 'pull_request' || github.context.eventName === 'pull_request_target') {
const pr = github.context.payload.pull_request as Webhooks.WebhookPayloadPullRequestPullRequest
return token ? await getChangedFilesFromApi(token, pr) : await getChangedFilesFromGit(pr.base.sha)
} else if (github.context.eventName === 'push') {