Skip to content

Commit

Permalink
Merge branch 'main' into chriseling-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed May 19, 2024
2 parents 9ffe5fd + 2a5b13d commit a06deb5
Show file tree
Hide file tree
Showing 295 changed files with 31,238 additions and 20,252 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/2_bug_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ body:
- "Medium"
- "Naver"
- "Netlify"
- "NetSuite"
- "Notion"
- "Okta"
- "OneLogin"
Expand Down
95 changes: 55 additions & 40 deletions .github/broken-link-checker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,46 +51,55 @@ async function updateCheckStatus(
const { context, getOctokit } = github
const octokit = getOctokit(process.env.GITHUB_TOKEN!)
const { owner, repo } = context.repo
const pullRequest = context.payload.pull_request
const sha = pullRequest?.head.sha

const checkParams = {
owner,
repo,
name: checkName,
head_sha: sha,
status: "completed" as const,
conclusion: "failure" as const,
output: {
title: checkName,
summary: summary,
text: text,
},
}

try {
await octokit.rest.checks.create(checkParams)
} catch (error) {
setFailed("Failed to create check: " + error)
// Can only update status on 'pull_request' events
if (context.payload.pull_request) {
const pullRequest = context.payload.pull_request
const sha = pullRequest?.head.sha

const checkParams = {
owner,
repo,
name: checkName,
head_sha: sha,
status: "completed" as const,
conclusion: "failure" as const,
output: {
title: checkName,
summary: summary,
text: text,
},
}

try {
await octokit.rest.checks.create(checkParams)
} catch (error) {
setFailed("Failed to create check: " + error)
}
}
}

const postComment = async (outputMd: string) => {
const postComment = async (
outputMd: string,
brokenLinkCount: number = 0
): Promise<string> => {
try {
const { context, getOctokit } = github
const octokit = getOctokit(process.env.GITHUB_TOKEN!)
const { owner, repo } = context.repo
const pullRequest = context.payload.pull_request
if (!pullRequest) {
console.log("Skipping since this is not a pull request")
process.exit(0)
let prNumber

// Handle various trigger events
if (context.payload.pull_request) {
// Triggered by `pull_request`
prNumber = context.payload.pull_request?.number
} else if (context.payload.issue) {
// Triggered by `issue_comment`
prNumber = context.payload?.issue?.number
}
const isFork = pullRequest.head.repo.fork
const prNumber = pullRequest.number
if (isFork) {
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."
)

if (!prNumber) {
setFailed("Count not find PR Number")
return ""
}

Expand All @@ -100,7 +109,6 @@ const postComment = async (outputMd: string) => {
repo,
prNumber,
})
console.log("botComment", botComment)
if (botComment) {
console.log("Updating Comment")
const { data } = await octokit.rest.issues.updateComment({
Expand All @@ -111,7 +119,7 @@ const postComment = async (outputMd: string) => {
})

return data.html_url
} else {
} else if (brokenLinkCount > 0) {
console.log("Creating Comment")
const { data } = await octokit.rest.issues.createComment({
owner,
Expand All @@ -121,6 +129,7 @@ const postComment = async (outputMd: string) => {
})
return data.html_url
}
return ""
} catch (error) {
setFailed("Error commenting: " + error)
return ""
Expand Down Expand Up @@ -211,23 +220,29 @@ async function brokenLinkChecker(): Promise<void> {
},
end: async () => {
if (output.links.length) {
// DEBUG
// console.debug(output.links)

// Skip links that returned 308
const links404 = output.links.filter(
const brokenLinksForAttention = output.links.filter(
(link) => link.broken && !["HTTP_308"].includes(link.brokenReason)
)

const outputMd = generateOutputMd({
errors: output.errors,
links: links404,
links: brokenLinksForAttention,
pages: [],
sites: [],
})
await postComment(outputMd)
const commentUrl = await postComment(
outputMd,
brokenLinksForAttention.length
)

// Update GitHub "check" status
await updateCheckStatus(brokenLinksForAttention.length, commentUrl)

// const commentUrl = await postComment(outputMd);
// NOTE: Do we need this additional check in GH output?
// await updateCheckStatus(output.links.length, commentUrl);
setFailed(`Found broken links`)
brokenLinksForAttention.length && setFailed(`Found broken links`)
}
},
})
Expand Down
21 changes: 8 additions & 13 deletions .github/workflows/broken-link-checker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: "Broken Link Checker"

on:
pull_request:
branches:
- main
paths:
- "docs/**"
issue_comment:
types: [edited]

permissions:
pull-requests: write
Expand All @@ -17,19 +15,16 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: corepack enable
- name: Get Vercel Preview URL
id: vercelDeployment
uses: mishkeTz/get-vercel-preview-url-by-project-id@main
- uses: aaimio/vercel-preview-url-action@v2.2.0
id: vercel_preview_url
with:
vercel_access_token: ${{ secrets.VERCEL_TOKEN }}
vercel_team_id: ${{ secrets.VERCEL_TEAM_ID }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
preview_url_regexp: https.*\/(.*-authjs.vercel.app)
- name: Install dependencies
run: cd ./.github/broken-link-checker && pnpm install --ignore-workspace && pnpm build
- name: Run link checker
uses: ./.github/broken-link-checker
id: broken-links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERCEL_PREVIEW_URL: ${{ steps.vercelDeployment.outputs.preview_url }}
VERCEL_PREVIEW_URL: https://${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
32 changes: 17 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ env:

jobs:
test:
name: Run release
name: Test
runs-on: ubuntu-latest
steps:
- name: Init
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
Expand All @@ -95,11 +95,11 @@ jobs:
if: ${{ github.repository == 'nextauthjs/next-auth' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Build
run: pnpm build
- name: Run unit tests
run: pnpm test
- name: Lint
run: pnpm lint
timeout-minutes: 15
- name: Run unit tests
run: pnpm test
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(pnpx playwright -V | awk '{ print $2 }')" >> $GITHUB_ENV
Expand All @@ -114,7 +114,7 @@ jobs:
if: steps.playwright-cache.outputs.cache-hit != 'true' && github.repository == 'nextauthjs/next-auth'
run: |
pnpm exec playwright install --with-deps chromium
- name: Run Docker E2E
- name: Run E2E tests (Nextjs-Docker)
continue-on-error: true
if: false
timeout-minutes: 15
Expand Down Expand Up @@ -148,29 +148,30 @@ jobs:
name: playwright-traces
path: "**/packages/utils/test-results/*/trace.zip"
retention-days: 7
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
if: always()
name: Coverage
with:
token: ${{ secrets.CODECOV_TOKEN }}

release-branch:
name: Publish branch
timeout-minutes: 120
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'push' }}
environment: Production
steps:
- name: Init
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# Please upvote https://github.com/orgs/community/discussions/13836
token: ${{ secrets.GH_PAT }}
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: "pnpm"
- name: Install dependencies
Expand All @@ -183,17 +184,18 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release-pr:
name: Publish PR
timeout-minutes: 120
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'pull_request' }}
environment: Preview
steps:
- name: Init
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
Expand Down Expand Up @@ -228,11 +230,11 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Init
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<img src="https://img.shields.io/npm/dm/next-auth?style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="GitHub Stars" />
</a>
<a href="https://www.npmjs.com/package/next-auth">
<img src="https://img.shields.io/github/v/release/nextauthjs/next-auth?label=latest&style=flat-square" alt="Github Stable Release" />
<img src="https://img.shields.io/github/v/release/nextauthjs/next-auth?label=latest&style=flat-square" alt="GitHub Stable Release" />
</a>
<a href="https://codecov.io/gh/nextauthjs/next-auth" >
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/nextauthjs/next-auth?token=o2KN5GrPsY&style=flat-square&logo=codecov">
Expand All @@ -32,7 +32,7 @@
.
</p>
<p align="center">
<kbd>Sponsored</kbd> Don't want to manage auth yourself? <a href="https://clerk.com?utm_source=sponsorship&utm_medium=github&utm_campaign=authjs&utm_content=cta" target="_blank">Check out Clerk →</a>
<kbd>Sponsored</kbd> Looking for a hosted alternative? <a href="https://go.clerk.com/5115vfK" target="_blank">Use Clerk →</a>
</p>
</p>

Expand Down Expand Up @@ -165,6 +165,13 @@ We have an [OpenCollective](https://opencollective.com/nextauth) for companies a
<div>superblog</div>
<sub>☁️</sub>
</td>
<td align="center" valign="top">
<a href="https://www.netlight.com/" target="_blank">
<img width="108" src="https://avatars.githubusercontent.com/u/1672348?s=200&v=4" alt="Netlight logo" />
</a><br />
<div>Netlight</div>
<sub>☁️</sub>
</td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 7 additions & 0 deletions apps/dev/express/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AUTH_SECRET=

AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=

AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=
21 changes: 21 additions & 0 deletions apps/dev/express/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# API keys and secrets
.env

# Dependency directory
node_modules

# Editors
.idea
*.iml
.vscode/settings.json

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist/**/*

# Ignore built css files
/public/css/output.css

14 changes: 14 additions & 0 deletions apps/dev/express/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

.DS_Store
node_modules
/dist
/.turbo
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
Loading

0 comments on commit a06deb5

Please sign in to comment.