Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 0 additions & 87 deletions .github/workflows/sync-team-members.yml

This file was deleted.

124 changes: 124 additions & 0 deletions .github/workflows/sync-website-content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Sync website content

on:
workflow_dispatch:
inputs:
reviewers:
description: 'Comma-separated team slugs or usernames'
required: false
default: 'admins'
schedule:
# Every Monday at 06:00 UTC
- cron: '0 6 * * 1'

permissions: {}

concurrency:
group: sync-website-content
cancel-in-progress: false

jobs:
sync:
if: github.repository == 'mui/material-ui'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base: [master, v9.x]
env:
BASE_BRANCH: ${{ matrix.base }}
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ matrix.base }}
- name: Set up pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Use Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '22.23.4'
cache: 'pnpm' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies
- run: pnpm install --frozen-lockfile
- name: Sync team members
id: team_members
run: |
{
echo 'summary<<SYNC_SUMMARY_EOF'
pnpm --silent exec tsx ./docs/scripts/syncTeamMembers.ts
echo 'SYNC_SUMMARY_EOF'
} >> "$GITHUB_OUTPUT"
- name: Sync careers
id: careers
# Older branches need the careers renderer and sync script backported first.
if: hashFiles('docs/scripts/syncCareers.ts') != ''
run: pnpm --silent exec tsx ./docs/scripts/syncCareers.ts
- name: Format synced content
run: pnpm exec pretty-quick --ignore-path .lintignore --branch "$BASE_BRANCH"
- name: Create or update pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SYNC_SUMMARY: ${{ steps.team_members.outputs.summary }}
CAREERS_SYNCED: ${{ steps.careers.outcome == 'success' }}
# Empty on scheduled runs, so fall back to the default reviewers.
REVIEWERS: ${{ inputs.reviewers || 'admins' }}
run: |
set -euo pipefail
git add --all -- docs/data/about/teamMembers.json docs/public/static/branding/about
if [ "$CAREERS_SYNCED" = 'true' ]; then
git add --all -- docs/data/careers
fi
if git diff --cached --quiet; then
echo 'No website content changes. Skipping PR.'
exit 0
fi

TITLE='[website] Sync website content'
BODY_FILE="$RUNNER_TEMP/website-content-pr-body.md"
cat > "$BODY_FILE" <<'BODY'
Automated sync of the About page team members from the [mui-about API](https://frontend-public.mui.com/api/mui-about).
BODY
if [ "$CAREERS_SYNCED" = 'true' ]; then
cat >> "$BODY_FILE" <<'BODY'

Sync the careers listing and full role pages from the [careers API](https://frontend-public.mui.com/api/mui-careers).
BODY
fi
printf '\n%s\n' "$SYNC_SUMMARY" >> "$BODY_FILE"

# `cherry-pick-*` is exempt from branch creation restrictions and required
# status checks. `docs-*` is only exempt from the former.
BRANCH="cherry-pick-sync-website-content-$BASE_BRANCH"
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git switch -C "$BRANCH"
git commit \
--message "$TITLE" \
--message "$(cat "$BODY_FILE")"
REMOTE_SHA="$(git ls-remote origin "refs/heads/$BRANCH" | cut -f1)"
git push --force-with-lease="refs/heads/$BRANCH:$REMOTE_SHA" origin "$BRANCH"

PR_NUMBER="$(gh pr list --base "$BASE_BRANCH" --head "$BRANCH" --state open --json number --jq '.[0].number')"
if [ -n "$PR_NUMBER" ]; then
gh pr edit "$PR_NUMBER" --title "$TITLE" --body-file "$BODY_FILE"
else
gh pr create \
--base "$BASE_BRANCH" \
--head "$BRANCH" \
--title "$TITLE" \
--body-file "$BODY_FILE" \
--label website
PR_NUMBER="$(gh pr list --base "$BASE_BRANCH" --head "$BRANCH" --state open --json number --jq '.[0].number')"
fi

REVIEWS_URL="repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/requested_reviewers"
IFS=',' read -ra REQUESTED_REVIEWERS <<< "$REVIEWERS"
for reviewer in "${REQUESTED_REVIEWERS[@]}"; do
reviewer="${reviewer//[[:space:]]/}"
[ -z "$reviewer" ] && continue
if ! gh api --method POST "$REVIEWS_URL" -f "team_reviewers[]=$reviewer" >/dev/null 2>&1; then
gh api --method POST "$REVIEWS_URL" -f "reviewers[]=$reviewer" >/dev/null
fi
done
27 changes: 27 additions & 0 deletions docs/data/careers/roles.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ export default withDeploymentConfig({
) {
return;
}
// getStaticPaths provides the concrete URLs for this dynamic page.
if (page.pathname === '/careers/roles/[slug]') {
return;
}
if (!page.children) {
// map api-docs to api
// i: /api-docs/* > /api/* (old structure)
Expand Down
Loading
Loading