Skip to content

Commit ddb3c11

Browse files
committed
chore: rebuild workflows for backport directory
1 parent ca7ca83 commit ddb3c11

19 files changed

+661
-410
lines changed

.commitlintrc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module.exports = {
55
rules: {
66
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
77
'header-max-length': [2, 'always', 80],
8-
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
8+
'subject-case': [0],
9+
'body-max-line-length': [0],
10+
'footer-max-line-length': [0],
911
},
1012
}

.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const localConfigs = readdir(__dirname)
1010

1111
module.exports = {
1212
root: true,
13+
ignorePatterns: [
14+
'tap-testdir*/',
15+
],
1316
extends: [
1417
'@npmcli',
1518
...localConfigs,
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Create Check'
4+
inputs:
5+
name:
6+
required: true
7+
token:
8+
required: true
9+
sha:
10+
required: true
11+
check-name:
12+
default: ''
13+
outputs:
14+
check-id:
15+
value: ${{ steps.create-check.outputs.check_id }}
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Get Workflow Job
20+
uses: actions/github-script@v7
21+
id: workflow
22+
env:
23+
JOB_NAME: "${{ inputs.name }}"
24+
SHA: "${{ inputs.sha }}"
25+
with:
26+
result-encoding: string
27+
script: |
28+
const { repo: { owner, repo}, runId, serverUrl } = context
29+
const { JOB_NAME, SHA } = process.env
30+
31+
const job = await github.rest.actions.listJobsForWorkflowRun({
32+
owner,
33+
repo,
34+
run_id: runId,
35+
per_page: 100
36+
}).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME)))
37+
38+
return [
39+
`This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`,
40+
'Run logs:',
41+
job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`,
42+
].join(' ')
43+
- name: Create Check
44+
uses: LouisBrunner/checks-action@v1.6.0
45+
id: create-check
46+
with:
47+
token: ${{ inputs.token }}
48+
sha: ${{ inputs.sha }}
49+
status: in_progress
50+
name: ${{ inputs.check-name || inputs.name }}
51+
output: |
52+
{"summary":"${{ steps.workflow.outputs.result }}"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Install Latest npm'
4+
description: 'Install the latest version of npm compatible with the Node version'
5+
inputs:
6+
node:
7+
description: 'Current Node version'
8+
required: true
9+
runs:
10+
using: "composite"
11+
steps:
12+
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
13+
- name: Update Windows npm
14+
if: |
15+
runner.os == 'Windows' && (
16+
startsWith(inputs.node, 'v10.') ||
17+
startsWith(inputs.node, 'v12.') ||
18+
startsWith(inputs.node, 'v14.')
19+
)
20+
shell: cmd
21+
run: |
22+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
23+
tar xf npm-7.5.4.tgz
24+
cd package
25+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
26+
cd ..
27+
rmdir /s /q package
28+
- name: Install Latest npm
29+
shell: bash
30+
env:
31+
NODE_VERSION: ${{ inputs.node }}
32+
working-directory: ${{ runner.temp }}
33+
run: |
34+
MATCH=""
35+
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
36+
37+
echo "node@$NODE_VERSION"
38+
39+
for SPEC in ${SPECS[@]}; do
40+
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
41+
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
42+
43+
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
44+
MATCH=$SPEC
45+
echo "Found compatible version: npm@$MATCH"
46+
break
47+
fi
48+
done
49+
50+
if [ -z $MATCH ]; then
51+
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
52+
exit 1
53+
fi
54+
55+
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
56+
- name: npm Version
57+
shell: bash
58+
run: npm -v

.github/dependabot.yml

+36
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ updates:
77
directory: /
88
schedule:
99
interval: daily
10+
target-branch: "main"
1011
allow:
1112
- dependency-type: direct
1213
versioning-strategy: increase-if-necessary
@@ -15,3 +16,38 @@ updates:
1516
prefix-development: chore
1617
labels:
1718
- "Dependencies"
19+
open-pull-requests-limit: 10
20+
- package-ecosystem: npm
21+
directory: /
22+
schedule:
23+
interval: daily
24+
target-branch: "release/v5"
25+
allow:
26+
- dependency-type: direct
27+
dependency-name: "@npmcli/template-oss"
28+
versioning-strategy: increase-if-necessary
29+
commit-message:
30+
prefix: deps
31+
prefix-development: chore
32+
labels:
33+
- "Dependencies"
34+
- "Backport"
35+
- "release/v5"
36+
open-pull-requests-limit: 10
37+
- package-ecosystem: npm
38+
directory: /
39+
schedule:
40+
interval: daily
41+
target-branch: "release/v6"
42+
allow:
43+
- dependency-type: direct
44+
dependency-name: "@npmcli/template-oss"
45+
versioning-strategy: increase-if-necessary
46+
commit-message:
47+
prefix: deps
48+
prefix-development: chore
49+
labels:
50+
- "Dependencies"
51+
- "Backport"
52+
- "release/v6"
53+
open-pull-requests-limit: 10

.github/settings.yml

+55-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
1-
---
2-
_extends: '.github:npm-cli/settings.yml'
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
repository:
4+
allow_merge_commit: false
5+
allow_rebase_merge: true
6+
allow_squash_merge: true
7+
squash_merge_commit_title: PR_TITLE
8+
squash_merge_commit_message: PR_BODY
9+
delete_branch_on_merge: true
10+
enable_automated_security_fixes: true
11+
enable_vulnerability_alerts: true
12+
13+
branches:
14+
- name: main
15+
protection:
16+
required_status_checks: null
17+
enforce_admins: true
18+
block_creations: true
19+
required_pull_request_reviews:
20+
required_approving_review_count: 1
21+
require_code_owner_reviews: true
22+
require_last_push_approval: true
23+
dismiss_stale_reviews: true
24+
restrictions:
25+
apps: []
26+
users: []
27+
teams: [ "cli-team" ]
28+
- name: release/v5
29+
protection:
30+
required_status_checks: null
31+
enforce_admins: true
32+
block_creations: true
33+
required_pull_request_reviews:
34+
required_approving_review_count: 1
35+
require_code_owner_reviews: true
36+
require_last_push_approval: true
37+
dismiss_stale_reviews: true
38+
restrictions:
39+
apps: []
40+
users: []
41+
teams: [ "cli-team" ]
42+
- name: release/v6
43+
protection:
44+
required_status_checks: null
45+
enforce_admins: true
46+
block_creations: true
47+
required_pull_request_reviews:
48+
required_approving_review_count: 1
49+
require_code_owner_reviews: true
50+
require_last_push_approval: true
51+
dismiss_stale_reviews: true
52+
restrictions:
53+
apps: []
54+
users: []
55+
teams: [ "cli-team" ]

.github/workflows/audit.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@ jobs:
1818
shell: bash
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
- name: Setup Git User
2323
run: |
2424
git config --global user.email "npm-cli+bot@github.com"
2525
git config --global user.name "npm CLI robot"
2626
- name: Setup Node
27-
uses: actions/setup-node@v3
27+
uses: actions/setup-node@v4
28+
id: node
2829
with:
29-
node-version: 18.x
30-
- name: Install npm@latest
31-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
32-
- name: npm Version
33-
run: npm -v
30+
node-version: 22.x
31+
check-latest: contains('22.x', '.x')
32+
- name: Install Latest npm
33+
uses: ./.github/actions/install-latest-npm
34+
with:
35+
node: ${{ steps.node.outputs.node-version }}
3436
- name: Install Dependencies
3537
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
36-
- name: Run Audit
37-
run: npm audit
38+
- name: Run Production Audit
39+
run: npm audit --omit=dev
40+
- name: Run Full Audit
41+
run: npm audit --audit-level=none

0 commit comments

Comments
 (0)