Skip to content

Commit 968517f

Browse files
committed
chore: resolve conflict
2 parents 8a43b85 + 76b9440 commit 968517f

File tree

111 files changed

+4239
-2294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+4239
-2294
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import { readFile } from 'node:fs/promises';
2+
3+
const CONFIG = {
4+
GOVERNANCE_FILE: 'GOVERNANCE.md',
5+
CURRENT_MEMBERS_HEADER: '#### Current Members',
6+
INACTIVE_MONTHS: 12,
7+
ISSUE_TITLE: 'Inactive Collaborator Report',
8+
ISSUE_LABELS: ['meta', 'inactive-collaborator-report'],
9+
};
10+
11+
// Get date N months ago in YYYY-MM-DD format
12+
const getDateMonthsAgo = (months = CONFIG.INACTIVE_MONTHS) => {
13+
const date = new Date();
14+
date.setMonth(date.getMonth() - months);
15+
return date.toISOString().split('T')[0];
16+
};
17+
18+
// Parse collaborator usernames from governance file
19+
async function parseCollaborators() {
20+
const content = await readFile(CONFIG.GOVERNANCE_FILE, 'utf8');
21+
const lines = content.split('\n');
22+
const collaborators = [];
23+
24+
const startIndex =
25+
lines.findIndex(l => l.startsWith(CONFIG.CURRENT_MEMBERS_HEADER)) + 1;
26+
if (startIndex <= 0) return collaborators;
27+
28+
for (let i = startIndex; i < lines.length; i++) {
29+
const line = lines[i];
30+
if (line.startsWith('#')) break;
31+
32+
const match = line.match(/^\s*-\s*\[([^\]]+)\]/);
33+
if (match) collaborators.push(match[1]);
34+
}
35+
36+
return collaborators;
37+
}
38+
39+
// Check if users have been active since cutoff date
40+
async function getInactiveUsers(github, usernames, repo, cutoffDate) {
41+
const inactiveUsers = [];
42+
43+
for (const username of usernames) {
44+
const { data } = await github.rest.search.commits({
45+
q: `author:${username} repo:${repo} committer-date:>=${cutoffDate}`,
46+
per_page: 1,
47+
});
48+
49+
if (data.total_count === 0) {
50+
inactiveUsers.push(username);
51+
}
52+
}
53+
54+
return inactiveUsers;
55+
}
56+
57+
// Generate report for inactive members
58+
function formatReport(inactiveMembers, cutoffDate) {
59+
if (!inactiveMembers.length) return null;
60+
61+
const today = getDateMonthsAgo(0);
62+
return `# Inactive Collaborators Report
63+
64+
Last updated: ${today}
65+
Checking for inactivity since: ${cutoffDate}
66+
67+
## Inactive Collaborators (${inactiveMembers.length})
68+
69+
| Login |
70+
| ----- |
71+
${inactiveMembers.map(m => `| @${m} |`).join('\n')}
72+
73+
## What happens next?
74+
75+
@nodejs/nodejs-website should review this list and contact inactive collaborators to confirm their continued interest in participating in the project.`;
76+
}
77+
78+
async function createOrUpdateIssue(github, context, report) {
79+
if (!report) return;
80+
81+
const { owner, repo } = context.repo;
82+
const { data: issues } = await github.rest.issues.listForRepo({
83+
owner,
84+
repo,
85+
state: 'open',
86+
labels: CONFIG.ISSUE_LABELS[1],
87+
per_page: 1,
88+
});
89+
90+
if (issues.total_count > 0) {
91+
await github.rest.issues.update({
92+
owner,
93+
repo,
94+
issue_number: issues.items[0].number,
95+
body: report,
96+
});
97+
} else {
98+
await github.rest.issues.create({
99+
owner,
100+
repo,
101+
title: CONFIG.ISSUE_TITLE,
102+
body: report,
103+
labels: CONFIG.ISSUE_LABELS,
104+
});
105+
}
106+
}
107+
108+
export default async function (github, context) {
109+
const cutoffDate = getDateMonthsAgo();
110+
const collaborators = await parseCollaborators();
111+
112+
const inactiveMembers = await getInactiveUsers(
113+
github,
114+
collaborators,
115+
`${context.repo.owner}/${context.repo.repo}`,
116+
cutoffDate
117+
);
118+
const report = formatReport(inactiveMembers, cutoffDate);
119+
120+
await createOrUpdateIssue(github, context, report);
121+
}

.github/workflows/chromatic.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ on:
1111
push:
1212
branches:
1313
- main
14+
paths:
15+
- packages/ui-components/**
16+
- .github/workflows/chromatic.yml
1417
pull_request_target:
1518
branches:
1619
- main
20+
paths:
21+
- packages/ui-components/**
22+
- .github/workflows/chromatic.yml
1723
types:
1824
- labeled
1925
workflow_dispatch:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Find inactive collaborators
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 4:05 AM UTC.
6+
- cron: 5 4 * * 1
7+
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
issues: write
13+
14+
jobs:
15+
find:
16+
if: github.repository == 'nodejs/nodejs.org'
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Harden Runner
21+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
22+
with:
23+
egress-policy: audit
24+
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
27+
- name: Report inactive collaborators
28+
id: inactive
29+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
30+
with:
31+
script: |
32+
const { default: report } = await import("${{github.workspace}}/.github/scripts/report-inactive-collaborators.mjs");
33+
report(github, context);

.github/workflows/lint-and-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ jobs:
149149
if: ${{ !cancelled() && github.event_name != 'merge_group' }}
150150
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
151151
with:
152-
files: ./apps/site/lcov.info,./packages/ui-components/lcov.info
152+
files: ./apps/site/lcov.info,./packages/*/lcov.info
153153

154154
- name: Upload test results to Codecov
155155
if: ${{ !cancelled() && github.event_name != 'merge_group' }}
156156
uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 # v1.1.0
157157
with:
158-
files: ./apps/site/junit.xml,./packages/ui-components/junit.xml
158+
files: ./apps/site/junit.xml,./packages/*/junit.xml

.github/workflows/cloudflare-open-next-build.yml renamed to .github/workflows/playwright-cloudflare-open-next.yml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!!
55
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
66

7-
name: Cloudflare OpenNext Build
7+
name: Playwright Tests on Cloudflare Open-Next
88

99
on:
1010
push:
@@ -14,24 +14,17 @@ on:
1414
branches:
1515
- main
1616

17-
defaults:
18-
run:
19-
# This ensures that the working directory is the root of the repository
20-
working-directory: ./
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
2120

2221
permissions:
2322
contents: read
2423
actions: read
2524

26-
env:
27-
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--cache-dir
28-
TURBO_ARGS: --cache-dir=.turbo/cache
29-
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--force
30-
TURBO_FORCE: true
31-
3225
jobs:
33-
build-cloudflare-worker:
34-
name: Build Cloudflare Worker
26+
playwright:
27+
name: Playwright Tests
3528
runs-on: ubuntu-latest
3629

3730
steps:
@@ -58,5 +51,32 @@ jobs:
5851
- name: Install packages
5952
run: pnpm install --frozen-lockfile
6053

61-
- name: Build Cloudflare Worker
62-
run: pnpm exec turbo run cloudflare:build:worker ${{ env.TURBO_ARGS }}
54+
- name: Get Playwright version
55+
id: playwright-version
56+
working-directory: apps/site
57+
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> $GITHUB_OUTPUT
58+
59+
- name: Cache Playwright browsers
60+
id: playwright-cache
61+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
62+
with:
63+
path: ~/.cache/ms-playwright
64+
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
65+
66+
- name: Install Playwright Browsers
67+
working-directory: apps/site
68+
run: pnpm exec playwright install --with-deps
69+
70+
- name: Run Playwright tests
71+
working-directory: apps/site
72+
run: pnpm playwright
73+
env:
74+
PLAYWRIGHT_RUN_CLOUDFLARE_PREVIEW: true
75+
PLAYWRIGHT_BASE_URL: http://127.0.0.1:8787
76+
77+
- name: Upload Playwright test results
78+
if: always()
79+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
80+
with:
81+
name: playwright-report
82+
path: apps/site/playwright-report/

.github/workflows/playwright.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Security Notes
2+
# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions)
3+
# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions.
4+
# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!!
5+
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
6+
# MERGE QUEUE NOTE: This Workflow does not run on `merge_group` trigger, as this Workflow is not required for Merge Queue's
7+
8+
name: Playwright Tests
9+
10+
on:
11+
pull_request:
12+
branches:
13+
- main
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
actions: read
22+
23+
jobs:
24+
get-vercel-preview:
25+
name: Get Vercel Preview
26+
runs-on: ubuntu-latest
27+
outputs:
28+
deployment_found: ${{ steps.set_outputs.outputs.deployment_found }}
29+
url: ${{ steps.set_outputs.outputs.url }}
30+
steps:
31+
- name: Capture Vercel Preview
32+
id: check_deployment
33+
uses: patrickedqvist/wait-for-vercel-preview@06c79330064b0e6ef7a2574603b62d3c98789125 # v1.3.2
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
max_timeout: 300 # timeout after 5 minutes
37+
check_interval: 10 # check every 10 seconds
38+
continue-on-error: true
39+
- name: Set Outputs
40+
if: always()
41+
id: set_outputs
42+
run: |
43+
if [[ -z "${{ steps.check_deployment.outputs.url }}" ]]; then
44+
echo "deployment_found=false" >> $GITHUB_OUTPUT
45+
else
46+
echo "deployment_found=true" >> $GITHUB_OUTPUT
47+
echo "url=${{ steps.check_deployment.outputs.url }}" >> $GITHUB_OUTPUT
48+
fi
49+
50+
playwright:
51+
needs: get-vercel-preview
52+
if: needs.get-vercel-preview.outputs.deployment_found == 'true'
53+
name: Playwright Tests
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Harden Runner
58+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
59+
with:
60+
egress-policy: audit
61+
62+
- name: Git Checkout
63+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
65+
- name: Set up pnpm
66+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
67+
with:
68+
cache: true
69+
70+
- name: Set up Node.js
71+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
72+
with:
73+
# We want to ensure that the Node.js version running here respects our supported versions
74+
node-version-file: '.nvmrc'
75+
cache: 'pnpm'
76+
77+
- name: Install packages
78+
run: pnpm install --frozen-lockfile
79+
80+
- name: Get Playwright version
81+
id: playwright-version
82+
working-directory: apps/site
83+
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> $GITHUB_OUTPUT
84+
85+
- name: Cache Playwright browsers
86+
id: playwright-cache
87+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
88+
with:
89+
path: ~/.cache/ms-playwright
90+
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
91+
92+
- name: Install Playwright Browsers
93+
working-directory: apps/site
94+
run: pnpm exec playwright install --with-deps
95+
96+
- name: Run Playwright tests
97+
working-directory: apps/site
98+
run: pnpm playwright
99+
env:
100+
PLAYWRIGHT_BASE_URL: ${{ needs.get-vercel-preview.outputs.url }}
101+
102+
- name: Upload Playwright test results
103+
if: always()
104+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
105+
with:
106+
name: playwright-report
107+
path: apps/site/playwright-report/

0 commit comments

Comments
 (0)