Skip to content

Commit 458e6d3

Browse files
Merge branch 'main' of https://github.com/auth0/auth0-spa-js into feat/online-access
2 parents f72913c + fff2dc7 commit 458e6d3

151 files changed

Lines changed: 954 additions & 508 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: lint-pr-title
2+
description: Ensure PR titles match the Conventional Commits Specification (https://www.conventionalcommits.org/).
3+
runs:
4+
using: 'node24'
5+
main: 'src/index.js'
6+
branding:
7+
icon: 'shield'
8+
color: 'green'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@auth0/lint-pr-title",
3+
"version": "1.0.0",
4+
"description": "Lint PR titles with commitlint",
5+
"main": "src/index.js",
6+
"type": "module",
7+
"private": true,
8+
"dependencies": {
9+
"@actions/core": "^3.0.0",
10+
"@actions/github": "^9.0.0",
11+
"@commitlint/format": "^20.0.0",
12+
"@commitlint/lint": "^20.0.0",
13+
"@commitlint/load": "^20.1.0"
14+
}
15+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { default as load } from '@commitlint/load';
2+
import { default as lint } from '@commitlint/lint';
3+
import { default as format } from '@commitlint/format';
4+
import * as core from '@actions/core';
5+
import * as github from '@actions/github';
6+
7+
async function run() {
8+
try {
9+
// 1. Get the pull request title
10+
const prTitle = github.context.payload.pull_request?.title;
11+
12+
if (!prTitle) {
13+
core.setFailed('⛔️ Could not get pull request title. This action should only be run on a pull_request event.');
14+
return;
15+
}
16+
17+
core.info(`📝 Validating PR Title: "${prTitle}"`);
18+
19+
// 2. Load the commitlint configuration from the repository
20+
const config = await load({}, { file: 'commitlint.config.mjs', cwd: process.cwd() });
21+
22+
if (!config.rules || Object.keys(config.rules).length === 0) {
23+
core.setFailed('⛔️ No commitlint rules loaded. Is commitlint.config.mjs present at the repo root?');
24+
return;
25+
}
26+
27+
core.info('✅ Loaded commitlint configuration successfully.');
28+
29+
// 3. Lint the pull request title
30+
const result = await lint(prTitle, config.rules, {
31+
defaultIgnores: config.defaultIgnores,
32+
helpUrl: config.helpUrl,
33+
});
34+
35+
// 4. Report the results
36+
if (result.valid) {
37+
core.info('✅ PR title is valid.');
38+
} else {
39+
const errors = format({ results: [result] }, { color: false }).trimEnd();
40+
const validTypes = config.rules['type-enum']?.[2]?.join(', ');
41+
const sep = '─'.repeat(49);
42+
const details = [
43+
errors,
44+
'',
45+
sep,
46+
' Expected format: <type>(<optional scope>): <subject>',
47+
...(validTypes ? ['', ` Valid types: ${validTypes}`] : []),
48+
'',
49+
' Examples:',
50+
' feat: add login with passkeys',
51+
' fix(cache): correct token expiry edge case',
52+
' ci: add PR title linting',
53+
'',
54+
' Learn more: https://www.conventionalcommits.org',
55+
sep,
56+
].join('\n');
57+
core.info(details);
58+
core.setFailed(`PR title "${prTitle}" does not follow the Conventional Commits format.`);
59+
}
60+
} catch (error) {
61+
if (error instanceof Error) {
62+
core.setFailed(`⛔️ Action failed with error: ${error.message}`);
63+
} else {
64+
core.setFailed('⛔️ An unknown error occurred.');
65+
}
66+
}
67+
}
68+
69+
run();

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ jobs:
3838
run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection.
3939

4040
- name: Checkout
41-
uses: actions/checkout@v6
41+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4242

4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v4
44+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
4545
with:
4646
languages: ${{ matrix.language }}
4747
queries: +security-and-quality
4848

4949
- name: Autobuild
50-
uses: github/codeql-action/autobuild@v4
50+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
5151

5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v4
53+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
5454
with:
5555
category: '/language:${{ matrix.language }}'

.github/workflows/cross-browser.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ jobs:
3535

3636
steps:
3737
- name: Checkout code
38-
uses: actions/checkout@v6
38+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3939
with:
4040
ref: ${{ github.event.pull_request.head.sha || github.ref }}
4141

4242
- name: Setup Node
43-
uses: actions/setup-node@v6
43+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
4444
with:
4545
node-version: ${{ env.NODE_VERSION }}
4646

4747
- name: Install dependencies
4848
run: npm i --include=dev
4949

5050
- name: Run cross-browser tests
51-
uses: cypress-io/github-action@v7
51+
uses: cypress-io/github-action@948d67d3074f1bbb6379c8bdbb04e95d2f8e593f # v7.4.0
5252
with:
5353
browser: ${{ matrix.browser }}
5454
start: npm run dev
@@ -58,7 +58,7 @@ jobs:
5858

5959
- name: Upload Cypress screenshots
6060
if: failure()
61-
uses: actions/upload-artifact@v7
61+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6262
with:
6363
name: cypress-screenshots-${{ matrix.browser }}-${{ github.run_id }}
6464
path: cypress/screenshots
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint PR Title
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
NODE_VERSION: 24
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
18+
19+
jobs:
20+
lint-title:
21+
name: Lint PR Title
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
29+
with:
30+
node-version: ${{ env.NODE_VERSION }}
31+
32+
- name: Install action dependencies
33+
run: npm install --ignore-scripts
34+
working-directory: .github/actions/lint-pr-title
35+
36+
- name: Lint PR Title
37+
uses: ./.github/actions/lint-pr-title

.github/workflows/npm-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
# Checkout the code
30-
- uses: actions/checkout@v6
30+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3131
with:
3232
fetch-depth: 0
3333

.github/workflows/rl-secure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
steps:
3535
- name: Checkout code
36-
uses: actions/checkout@v6
36+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3737
with:
3838
fetch-depth: 0
3939

.github/workflows/snyk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group'
3232
run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection.
3333

34-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3535
with:
3636
ref: ${{ github.event.pull_request.head.sha || github.ref }}
3737

.github/workflows/test.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ jobs:
3636

3737
steps:
3838
- name: Checkout code
39-
uses: actions/checkout@v6
39+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4040

4141
- name: Build package
4242
uses: ./.github/actions/build
4343
with:
4444
node: ${{ env.NODE_VERSION }}
4545

4646
- name: Save build artifacts
47-
uses: actions/cache/save@v5
47+
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
4848
with:
4949
path: .
5050
key: ${{ env.CACHE_KEY }}
@@ -57,15 +57,15 @@ jobs:
5757

5858
steps:
5959
- name: Checkout code
60-
uses: actions/checkout@v6
60+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
6161

6262
- name: Setup Node
63-
uses: actions/setup-node@v6
63+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
6464
with:
6565
node-version: ${{ env.NODE_VERSION }}
6666

6767
- name: Restore build artifacts
68-
uses: actions/cache/restore@v5
68+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6969
with:
7070
path: .
7171
key: ${{ env.CACHE_KEY }}
@@ -86,21 +86,24 @@ jobs:
8686

8787
steps:
8888
- name: Checkout code
89-
uses: actions/checkout@v6
89+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
9090

9191
- name: Setup Node
92-
uses: actions/setup-node@v6
92+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
9393
with:
9494
node-version: ${{ env.NODE_VERSION }}
9595

9696
- name: Restore build artifacts
97-
uses: actions/cache/restore@v5
97+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
9898
with:
9999
path: .
100100
key: ${{ env.CACHE_KEY }}
101101

102-
- name: Generate type declarations
103-
run: npm run build:types
102+
- name: Verify type declarations
103+
run: |
104+
count=$(npm pack --dry-run 2>&1 | grep -c "dist/typings/" || true)
105+
echo "Found $count typings files in package"
106+
test "$count" -gt 0 || { echo "typings not included in package!"; exit 1; }
104107
105108
gatsby:
106109
needs: test
@@ -114,7 +117,7 @@ jobs:
114117
115118
steps:
116119
- name: Checkout code
117-
uses: actions/checkout@v6
120+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
118121

119122
- name: Run framework tests
120123
uses: ./.github/actions/framework
@@ -137,7 +140,7 @@ jobs:
137140

138141
steps:
139142
- name: Checkout code
140-
uses: actions/checkout@v6
143+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
141144

142145
- name: Run framework tests
143146
uses: ./.github/actions/framework
@@ -159,7 +162,7 @@ jobs:
159162

160163
steps:
161164
- name: Checkout code
162-
uses: actions/checkout@v6
165+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
163166

164167
- name: Run framework tests
165168
uses: ./.github/actions/framework
@@ -181,7 +184,7 @@ jobs:
181184

182185
steps:
183186
- name: Checkout code
184-
uses: actions/checkout@v6
187+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
185188

186189
- name: Run framework tests
187190
uses: ./.github/actions/framework

0 commit comments

Comments
 (0)