Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
bee02f9a
Unverified
Commit
bee02f9a
authored
Jul 15, 2024
by
Sebastian Silbermann
Committed by
GitHub
Jul 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude changes that already landed in canary when finding changed tests (#64218)
parent
08da98df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
get-changed-tests.mjs
scripts/get-changed-tests.mjs
+33
-7
No files found.
scripts/get-changed-tests.mjs
View file @
bee02f9a
...
@@ -46,16 +46,42 @@ export default async function getChangedTests() {
...
@@ -46,16 +46,42 @@ export default async function getChangedTests() {
return
{
devTests
:
[],
prodTests
:
[]
}
return
{
devTests
:
[],
prodTests
:
[]
}
}
}
try
{
let
diffRevision
await
execa
(
'git remote set-branches --add origin canary'
,
EXECA_OPTS_STDIO
)
if
(
await
execa
(
'git fetch origin canary --depth=20'
,
EXECA_OPTS_STDIO
)
process
.
env
.
GITHUB_ACTIONS
===
'true'
&&
}
catch
(
err
)
{
process
.
env
.
GITHUB_EVENT_NAME
===
'pull_request'
console
.
error
(
await
execa
(
'git remote -v'
,
EXECA_OPTS_STDIO
))
)
{
console
.
error
(
`Failed to fetch origin/canary`
,
err
)
// GH Actions for `pull_request` run on the merge commit so HEAD~1:
// 1. includes all changes in the PR
// e.g. in
// A-B-C-main - F
// \ /
// D-E-branch
// GH actions for `branch` runs on F, so a diff for HEAD~1 includes the diff of D and E combined
// 2. Includes all changes of the commit for pushes
diffRevision
=
'HEAD~1'
}
else
{
try
{
await
execa
(
'git remote set-branches --add origin canary'
,
EXECA_OPTS_STDIO
)
await
execa
(
'git fetch origin canary --depth=20'
,
EXECA_OPTS_STDIO
)
}
catch
(
err
)
{
console
.
error
(
await
execa
(
'git remote -v'
,
EXECA_OPTS_STDIO
))
console
.
error
(
`Failed to fetch origin/canary`
,
err
)
}
// TODO: We should diff against the merge base with origin/canary not directly against origin/canary.
// A --- B ---- origin/canary
// \
// \-- C ---- HEAD
// `git diff origin/canary` includes B and C
// But we should only include C.
diffRevision
=
'origin/canary'
}
}
const
changesResult
=
await
execa
(
const
changesResult
=
await
execa
(
`git diff
origin/canary
--name-only`
,
`git diff
${
diffRevision
}
--name-only`
,
EXECA_OPTS
EXECA_OPTS
).
catch
((
err
)
=>
{
).
catch
((
err
)
=>
{
console
.
error
(
err
)
console
.
error
(
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment