From 9d41f5b5e55fd87a73930bfff8c80741f3d83843 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 9 Jan 2023 18:35:11 +0100 Subject: [PATCH 1/2] @primer/octicons@17.10.1 @primer/octicons-react@17.10.1 (#33841) --- package-lock.json | 30 ++++++++++++++---------------- package.json | 4 ++-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index bbcfae4280b6..87553fcae031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "@github/failbot": "0.8.0", "@primer/behaviors": "^1.3.1", "@primer/css": "^20.2.4", - "@primer/octicons": "17.7.0", - "@primer/octicons-react": "17.7.0", + "@primer/octicons": "17.10.1", + "@primer/octicons-react": "17.10.1", "@primer/react": "^35.2.2", "accept-language-parser": "^1.5.0", "ajv": "^8.11.0", @@ -4114,19 +4114,17 @@ } }, "node_modules/@primer/octicons": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.7.0.tgz", - "integrity": "sha512-J5cVJDhExmqLGLWu8zHTOqcC8g1rQL7QzQZdbvHxW85u8ya82GtF5F68uHMDI5En3fsMlbkkF8Rz6dCaV3r+KA==", - "license": "MIT", + "version": "17.10.1", + "resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.10.1.tgz", + "integrity": "sha512-fyq/lItQp18Ibi7c2oXVVw7H5K2a8qb8D2dnkTLf2+yUPjc3Fc+SEGS9x6iU6sQAEpr4LctcFl9ZSZ732EM63A==", "dependencies": { "object-assign": "^4.1.1" } }, "node_modules/@primer/octicons-react": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-17.7.0.tgz", - "integrity": "sha512-rxJiArra+q7lorhzQH223btMcRR8di9TUei9DhQG18jmVEI+wQTY+MypI5FZqU8UyehBOtcnD4TWx+i4Zwpz5Q==", - "license": "MIT", + "version": "17.10.1", + "resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-17.10.1.tgz", + "integrity": "sha512-27F3OyrZVifha5bw84lVnuoxcLWaQFiOZ840itfvzRqlDD03q+bUb0wrw26+hGbbXuX8I65rzxh75T32blZFIw==", "engines": { "node": ">=8" }, @@ -23400,17 +23398,17 @@ } }, "@primer/octicons": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.7.0.tgz", - "integrity": "sha512-J5cVJDhExmqLGLWu8zHTOqcC8g1rQL7QzQZdbvHxW85u8ya82GtF5F68uHMDI5En3fsMlbkkF8Rz6dCaV3r+KA==", + "version": "17.10.1", + "resolved": "https://registry.npmjs.org/@primer/octicons/-/octicons-17.10.1.tgz", + "integrity": "sha512-fyq/lItQp18Ibi7c2oXVVw7H5K2a8qb8D2dnkTLf2+yUPjc3Fc+SEGS9x6iU6sQAEpr4LctcFl9ZSZ732EM63A==", "requires": { "object-assign": "^4.1.1" } }, "@primer/octicons-react": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-17.7.0.tgz", - "integrity": "sha512-rxJiArra+q7lorhzQH223btMcRR8di9TUei9DhQG18jmVEI+wQTY+MypI5FZqU8UyehBOtcnD4TWx+i4Zwpz5Q==", + "version": "17.10.1", + "resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-17.10.1.tgz", + "integrity": "sha512-27F3OyrZVifha5bw84lVnuoxcLWaQFiOZ840itfvzRqlDD03q+bUb0wrw26+hGbbXuX8I65rzxh75T32blZFIw==", "requires": {} }, "@primer/primitives": { diff --git a/package.json b/package.json index 4bd6b9193158..317673ec349d 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "@github/failbot": "0.8.0", "@primer/behaviors": "^1.3.1", "@primer/css": "^20.2.4", - "@primer/octicons": "17.7.0", - "@primer/octicons-react": "17.7.0", + "@primer/octicons": "17.10.1", + "@primer/octicons-react": "17.10.1", "@primer/react": "^35.2.2", "accept-language-parser": "^1.5.0", "ajv": "^8.11.0", From 103d2ca6c28c1d56ed7f6d2491512f6fef2f9ab2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 9 Jan 2023 18:46:50 +0100 Subject: [PATCH 2/2] experiment with npm install reusable workflow (#33480) --- .github/actions/node-npm-setup/action.yml | 22 +++++++++++++++++++ .../check-broken-links-github-github.yml | 9 +------- .github/workflows/code-lint.yml | 17 ++------------ .github/workflows/enterprise-dates.yml | 9 +------- .github/workflows/keep-caches-warm.yml | 15 +------------ .github/workflows/link-check-daily.yml | 8 +------ .github/workflows/link-check-on-pr.yml | 15 +------------ .github/workflows/manually-purge-fastly.yml | 3 +-- .github/workflows/open-enterprise-issue.yml | 9 +------- .github/workflows/openapi-decorate.yml | 9 +------- .github/workflows/orphaned-assets-check.yml | 9 +------- .github/workflows/purge-fastly.yml | 9 +------- .../workflows/sync-search-elasticsearch.yml | 9 +------- .github/workflows/sync-search-pr.yml | 15 +------------ .github/workflows/test.yml | 9 +------- .../workflows/translation-health-report.yml | 8 +------ .github/workflows/update-graphql-files.yml | 8 +------ tests/unit/actions-workflows.js | 8 ++++++- 18 files changed, 46 insertions(+), 145 deletions(-) create mode 100644 .github/actions/node-npm-setup/action.yml diff --git a/.github/actions/node-npm-setup/action.yml b/.github/actions/node-npm-setup/action.yml new file mode 100644 index 000000000000..d00faed4088a --- /dev/null +++ b/.github/actions/node-npm-setup/action.yml @@ -0,0 +1,22 @@ +name: Node set up composite + +description: Will set up Node and install all packages by caching node_modules + +runs: + using: 'composite' + steps: + - name: Cache node_modules + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + with: + path: node_modules + key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} + + - name: Setup node + uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 + with: + node-version: '16.17.0' + cache: npm + + - name: Install dependencies + shell: bash + run: npm install --prefer-offline --no-audit --ignore-scripts diff --git a/.github/workflows/check-broken-links-github-github.yml b/.github/workflows/check-broken-links-github-github.yml index 16d523043969..ecb9b7a439b3 100644 --- a/.github/workflows/check-broken-links-github-github.yml +++ b/.github/workflows/check-broken-links-github-github.yml @@ -52,17 +52,10 @@ jobs: path: docs-early-access ref: main - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - name: Merge docs-early-access repo's folders run: .github/actions-scripts/merge-early-access.sh - - name: Install Node.js dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Build server run: npm run build diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index c4b0ef2563e9..bc677996db56 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -34,25 +34,12 @@ concurrency: jobs: lint: if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' - runs-on: ubuntu-latest + runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }} steps: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache node_modules - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 - with: - path: node_modules - key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} - - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm install --prefer-offline --no-audit --ignore-scripts + - uses: ./.github/actions/node-npm-setup - name: Run linter run: npm run lint diff --git a/.github/workflows/enterprise-dates.yml b/.github/workflows/enterprise-dates.yml index 73f0f0033f23..bb03dbc1e49e 100644 --- a/.github/workflows/enterprise-dates.yml +++ b/.github/workflows/enterprise-dates.yml @@ -38,14 +38,7 @@ jobs: - name: Checkout repository code uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install Node.js dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Run script/update-enterprise-dates.js run: | diff --git a/.github/workflows/keep-caches-warm.yml b/.github/workflows/keep-caches-warm.yml index bdefacf8b4eb..293af3f500cf 100644 --- a/.github/workflows/keep-caches-warm.yml +++ b/.github/workflows/keep-caches-warm.yml @@ -23,20 +23,7 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache node_modules - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 - with: - path: node_modules - key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} - - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm install --prefer-offline --no-audit --ignore-scripts + - uses: ./.github/actions/node-npm-setup - name: Cache nextjs build uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 diff --git a/.github/workflows/link-check-daily.yml b/.github/workflows/link-check-daily.yml index a3249437251b..72a6dc3e6750 100644 --- a/.github/workflows/link-check-daily.yml +++ b/.github/workflows/link-check-daily.yml @@ -24,14 +24,8 @@ jobs: - name: Check out repo's default branch uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Figure out which docs-early-access branch to checkout, if internal repo if: ${{ github.repository == 'github/docs-internal' }} diff --git a/.github/workflows/link-check-on-pr.yml b/.github/workflows/link-check-on-pr.yml index 13d00a5eea48..8efb2ca526e6 100644 --- a/.github/workflows/link-check-on-pr.yml +++ b/.github/workflows/link-check-on-pr.yml @@ -28,20 +28,7 @@ jobs: - name: Checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache node_modules - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 - with: - path: node_modules - key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} - - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm install --prefer-offline --no-audit --ignore-scripts + - uses: ./.github/actions/node-npm-setup - name: Figure out which docs-early-access branch to checkout, if internal repo if: ${{ github.repository == 'github/docs-internal' }} diff --git a/.github/workflows/manually-purge-fastly.yml b/.github/workflows/manually-purge-fastly.yml index bde1ec37ecd0..29180f0aed81 100644 --- a/.github/workflows/manually-purge-fastly.yml +++ b/.github/workflows/manually-purge-fastly.yml @@ -18,8 +18,7 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Soft-purge Fastly cache env: diff --git a/.github/workflows/open-enterprise-issue.yml b/.github/workflows/open-enterprise-issue.yml index 187e1b4563f9..45e739af69d4 100644 --- a/.github/workflows/open-enterprise-issue.yml +++ b/.github/workflows/open-enterprise-issue.yml @@ -21,14 +21,7 @@ jobs: - name: Checkout repository code uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Check for existing release or deprecation issues id: existingIssue diff --git a/.github/workflows/openapi-decorate.yml b/.github/workflows/openapi-decorate.yml index 530be9dc45c6..bec10987d429 100644 --- a/.github/workflows/openapi-decorate.yml +++ b/.github/workflows/openapi-decorate.yml @@ -45,14 +45,7 @@ jobs: # CI in the PR. (Events from GITHUB_TOKEN don't trigger new workflows.) token: ${{ secrets.DOCUBOT_REPO_PAT }} - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Decorate the dereferenced OpenAPI schemas run: script/rest/update-files.js --decorate-only diff --git a/.github/workflows/orphaned-assets-check.yml b/.github/workflows/orphaned-assets-check.yml index d0d5763ce338..001e3ee9157b 100644 --- a/.github/workflows/orphaned-assets-check.yml +++ b/.github/workflows/orphaned-assets-check.yml @@ -85,14 +85,7 @@ jobs: token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }} path: translations/ko-KR - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Check for orphaned assets env: diff --git a/.github/workflows/purge-fastly.yml b/.github/workflows/purge-fastly.yml index 92f77cee0333..c0ac1cf4f38d 100644 --- a/.github/workflows/purge-fastly.yml +++ b/.github/workflows/purge-fastly.yml @@ -35,14 +35,7 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Purge Fastly edge cache independent of language if: ${{ github.event.inputs.nuke_all }} diff --git a/.github/workflows/sync-search-elasticsearch.yml b/.github/workflows/sync-search-elasticsearch.yml index 7c704f3fbdf1..12eb39175a44 100644 --- a/.github/workflows/sync-search-elasticsearch.yml +++ b/.github/workflows/sync-search-elasticsearch.yml @@ -118,14 +118,7 @@ jobs: token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }} path: translation - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Cache nextjs build uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 diff --git a/.github/workflows/sync-search-pr.yml b/.github/workflows/sync-search-pr.yml index 18c22374cbd3..a90a0b7de572 100644 --- a/.github/workflows/sync-search-pr.yml +++ b/.github/workflows/sync-search-pr.yml @@ -46,20 +46,7 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache node_modules - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 - with: - path: node_modules - key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} - - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm install --prefer-offline --no-audit --ignore-scripts + - uses: ./.github/actions/node-npm-setup - name: Cache nextjs build uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73a7116f104b..fb8adab9eaba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,14 +67,7 @@ jobs: - name: Check out repo uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - - name: Install dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Figure out which docs-early-access branch to checkout, if internal repo if: ${{ github.repository == 'github/docs-internal' }} diff --git a/.github/workflows/translation-health-report.yml b/.github/workflows/translation-health-report.yml index 86971f9d5868..eb4b2f2c0b71 100644 --- a/.github/workflows/translation-health-report.yml +++ b/.github/workflows/translation-health-report.yml @@ -72,13 +72,7 @@ jobs: gitref=$(cd ${{ matrix.language_dir }} && git rev-parse --short HEAD) echo "gitref=$gitref" >> $GITHUB_ENV - - name: 'Setup node' - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - - - name: npm ci - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Create translation health report run: | diff --git a/.github/workflows/update-graphql-files.yml b/.github/workflows/update-graphql-files.yml index 1ac0ca37a0e9..7a1de4611308 100644 --- a/.github/workflows/update-graphql-files.yml +++ b/.github/workflows/update-graphql-files.yml @@ -33,13 +33,7 @@ jobs: exit 1 # prevents further steps from running - name: Checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Setup Node - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 - with: - node-version: '16.17.0' - cache: npm - - name: Install Node.js dependencies - run: npm ci + - uses: ./.github/actions/node-npm-setup - name: Run updater scripts env: # need to use a token from a user with access to github/github for this step diff --git a/tests/unit/actions-workflows.js b/tests/unit/actions-workflows.js index d0cbc9e2ab73..1b02acd38228 100644 --- a/tests/unit/actions-workflows.js +++ b/tests/unit/actions-workflows.js @@ -27,7 +27,13 @@ const scheduledWorkflows = workflows .flat() .map((schedule) => schedule.cron) -const allUsedActions = chain(workflows).map(actionsUsedInWorkflow).flatten().uniq().sort().value() +const allUsedActions = chain(workflows) + .map(actionsUsedInWorkflow) + .flatten() + .uniq() + .filter((use) => !use.startsWith('.')) + .sort() + .value() describe('GitHub Actions workflows', () => { test('all used actions are listed', () => {