Skip to content

Commit

Permalink
Merge branch 'canary' into 07-01-Add_envvar_app_router_example
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-lutz committed Jul 5, 2023
2 parents d399223 + fd508b0 commit 527b827
Show file tree
Hide file tree
Showing 98 changed files with 1,233 additions and 605 deletions.
2 changes: 1 addition & 1 deletion .github/actions/validate-docs-links/lib/index.js

Large diffs are not rendered by default.

73 changes: 54 additions & 19 deletions .github/actions/validate-docs-links/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,56 @@ async function updateComment(
}
}

async function createComment(comment: string): Promise<string> {
try {
const { data } = await octokit.rest.issues.createComment({
owner,
repo,
issue_number: pullRequest.number,
body: comment,
async function createComment(
comment: string,
allErrors: Errors[]
): Promise<string> {
const isFork = pullRequest.head.repo.fork

if (isFork) {
const errorTableData = allErrors.flatMap((errors) => {
const {
doc,
brokenLinks,
brokenHashes,
brokenSourceLinks,
brokenRelatedLinks,
} = errors

const allBrokenLinks = [
...brokenLinks,
...brokenHashes,
...brokenSourceLinks,
...brokenRelatedLinks,
]

return allBrokenLinks.map((link) => ({
path: doc.path,
link,
}))
})

return data.html_url
} catch (error) {
setFailed('Error creating comment: ' + error)
console.log('This PR introduces broken links to the docs:')
console.table(errorTableData, ['path', 'link'])
setFailed(
'The action could not create a Github comment because it is initiated from a forked repo. View the action logs for a list of broken links.'
)

return ''
} else {
try {
const { data } = await octokit.rest.issues.createComment({
owner,
repo,
issue_number: pullRequest.number,
body: comment,
})

return data.html_url
} catch (error) {
setFailed('Error creating comment: ' + error)
return ''
}
}
}

Expand Down Expand Up @@ -404,6 +441,8 @@ async function validateAllInternalLinks(): Promise<void> {
let errorComment =
'Hi there :wave:\n\nIt looks like this PR introduces broken links to the docs, please take a moment to fix them before merging:\n\n| :heavy_multiplication_x: Broken link | :page_facing_up: File | \n| ----------- | ----------- | \n'

let errorsExist = false

allErrors.forEach((errors) => {
const {
doc: { path: docPath },
Expand All @@ -414,24 +453,28 @@ async function validateAllInternalLinks(): Promise<void> {
} = errors

if (brokenLinks.length > 0) {
errorsExist = true
brokenLinks.forEach((link) => {
errorComment += formatTableRow(link, docPath)
})
}

if (brokenHashes.length > 0) {
errorsExist = true
brokenHashes.forEach((hash) => {
errorComment += formatTableRow(hash, docPath)
})
}

if (brokenSourceLinks.length > 0) {
errorsExist = true
brokenSourceLinks.forEach((link) => {
errorComment += formatTableRow(link, docPath)
})
}

if (brokenRelatedLinks.length > 0) {
errorsExist = true
brokenRelatedLinks.forEach((link) => {
errorComment += formatTableRow(link, docPath)
})
Expand All @@ -440,14 +483,6 @@ async function validateAllInternalLinks(): Promise<void> {

errorComment += '\nThank you :pray:'

const errorsExist = allErrors.some(
(errors) =>
errors.brokenLinks.length > 0 ||
errors.brokenHashes.length > 0 ||
errors.brokenSourceLinks.length > 0 ||
errors.brokenRelatedLinks.length > 0
)

const botComment = await findBotComment()

let commentUrl
Expand All @@ -457,7 +492,7 @@ async function validateAllInternalLinks(): Promise<void> {
if (botComment) {
commentUrl = await updateComment(comment, botComment)
} else {
commentUrl = await createComment(comment)
commentUrl = await createComment(comment, allErrors)
}
} else {
const comment = `${COMMENT_TAG}\nAll broken links are now fixed, thank you!`
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ jobs:
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" TURBOPACK=1 __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --type development --timings -c ${TEST_CONCURRENCY}
secrets: inherit

test-turbopack-integration:
name: test turbopack integration
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5, 6]

uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 16
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" TURBOPACK=1 __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" node run-tests.js --timings -g ${{ matrix.group }}/6 -c ${TEST_CONCURRENCY} --test-pattern '^(integration)/.*\.test\.(js|jsx|ts|tsx)$'
secrets: inherit

test-next-swc-wasm:
name: test next-swc wasm
needs: ['build-native', 'build-next']
Expand Down Expand Up @@ -185,7 +200,14 @@ jobs:
secrets: inherit

report-test-results:
needs: ['test-dev', 'test-prod', 'test-integration', 'test-turbopack-dev']
needs:
[
'test-dev',
'test-prod',
'test-integration',
'test-turbopack-dev',
'test-turbopack-integration',
]
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
Expand All @@ -208,11 +230,12 @@ jobs:
'rust-check',
'test-next-swc-wasm',
'test-turbopack-dev',
'test-turbopack-integration',
]

if: always()
runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
name: thank you, next
steps:
- run: exit 1
if: ${{ always() && contains(needs.*.result, 'failure') }}
if: ${{ always() && !contains(needs.*.result, 'success') }}

0 comments on commit 527b827

Please sign in to comment.