Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflow): add cache to workflows using actions/setup-node #7940

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ name: Browser Tests
# **Who does it impact**: Docs engineering, open-source engineering contributors.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
pull_request:

pull_request: null
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -24,6 +23,7 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Get npm cache directory
id: npm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dry-run-sync-algolia-search-indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ name: (Dry run) Algolia
# **Who does it impact**: Docs engineering.

on:
workflow_dispatch:

workflow_dispatch: null
jobs:
updateIndices:
name: (Dry run) Update indices
Expand All @@ -18,6 +17,7 @@ jobs:
- uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm
- name: cache node modules
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/js-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ name: Lint JS
# **Who does it impact**: Docs engineering, open-source engineering contributors.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
pull_request:

pull_request: null
jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -22,6 +21,7 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Get npm cache directory
id: npm-cache
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/link-check-dotcom.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: 'Link Checker: Dotcom'
name: "Link Checker: Dotcom"

# **What it does**: This checks links for dotcom version of docs.
# **Why we have it**: We want to know if links break.
# **Who does it impact**: Docs content.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
pull_request:

pull_request: null
jobs:
build:
runs-on: ${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
runs-on:
${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository ==
'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
Expand All @@ -24,14 +25,15 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: 'Link check: Dotcom'
- name: "Link check: Dotcom"
env:
DOCS_VERSION: 'dotcom'
DOCS_VERSION: "dotcom"
run: npm run link-check
16 changes: 9 additions & 7 deletions .github/workflows/link-check-ghae.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: 'Link Checker: GitHub AE'
name: "Link Checker: GitHub AE"

# **What it does**: This checks links for GHAE version of docs.
# **Why we have it**: We want to know if links break.
# **Who does it impact**: Docs content.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
pull_request:

pull_request: null
jobs:
build:
runs-on: ${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
runs-on:
${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository ==
'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
Expand All @@ -24,14 +25,15 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: 'Link check: GitHub AE'
- name: "Link check: GitHub AE"
env:
DOCS_VERSION: 'github-ae'
DOCS_VERSION: "github-ae"
run: npm run link-check
16 changes: 9 additions & 7 deletions .github/workflows/link-check-ghes.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: 'Link Checker: Enterprise Server'
name: "Link Checker: Enterprise Server"

# **What it does**: This checks links for GHES version of docs.
# **Why we have it**: We want to know if links break.
# **Who does it impact**: Docs content.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
pull_request:

pull_request: null
jobs:
build:
runs-on: ${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
runs-on:
${{ fromJson('["ubuntu-latest", "self-hosted"]')[github.repository ==
'github/docs-internal'] }}
steps:
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
# Even if if doesn't do anything
Expand All @@ -24,14 +25,15 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Install
run: npm ci

- name: Build
run: npm run build

- name: 'Link check: Enterprise Server'
- name: "Link check: Enterprise Server"
env:
DOCS_VERSION: 'enterprise-server'
DOCS_VERSION: "enterprise-server"
run: npm run link-check
8 changes: 5 additions & 3 deletions .github/workflows/pa11y.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ name: Pa11y
# **Who does it impact**: Docs engineering, users who need accessibility features.

on:
workflow_dispatch:
workflow_dispatch: null
schedule:
- cron: '25 17 * * *' # once a day at 17:25 UTC / 11:50 PST
- cron: "25 17 * * *" # once a day at 17:25 UTC / 11:50 PST
jobs:
test:
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
if: github.repository == 'github/docs-internal' || github.repository ==
'github/docs'
runs-on: ubuntu-latest
steps:
- name: Check out repo
Expand All @@ -20,6 +21,7 @@ jobs:
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Get npm cache directory
id: npm-cache
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/staging-deploy-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ on:
workflow_dispatch:
inputs:
pullRequestUrl:
description: 'Pull Request URL'
description: "Pull Request URL"
required: true
default: 'https://github.com/github/docs/pull/1234'
default: "https://github.com/github/docs/pull/1234"
forceRebuild:
description: 'Force the Heroku App to be rebuilt from scratch? (true/false)'
description: "Force the Heroku App to be rebuilt from scratch? (true/false)"
required: false
default: 'false'
default: "false"

jobs:
validate-inputs:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
if: ${{ github.repository == 'github/docs-internal' || github.repository ==
'github/docs' }}
name: Validate inputs
runs-on: ubuntu-latest
timeout-minutes: 2
Expand All @@ -36,13 +37,14 @@ jobs:
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'
persist-credentials: "false"

- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Get npm cache directory
Expand Down Expand Up @@ -95,7 +97,8 @@ jobs:
core.setOutput('headRef', pullRequest.head.ref)

deploy:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
if: ${{ github.repository == 'github/docs-internal' || github.repository ==
'github/docs' }}
needs: validate-inputs
name: Deploy
runs-on: ubuntu-latest
Expand All @@ -108,12 +111,13 @@ jobs:
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'
persist-credentials: "false"

- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Get npm cache directory
id: npm-cache
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/staging-undeploy-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ on:

jobs:
undeploy:
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
if: ${{ github.repository == 'github/docs-internal' || github.repository ==
'github/docs' }}
name: Undeploy
runs-on: ubuntu-latest
timeout-minutes: 2
Expand All @@ -24,12 +25,13 @@ jobs:
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
# Enables cloning the Early Access repo later with the relevant PAT
persist-credentials: 'false'
persist-credentials: "false"

- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm

- name: Get npm cache directory
id: npm-cache
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/sync-algolia-search-indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Algolia
# **Who does it impact**: Anyone using search on docs.

on:
workflow_dispatch:
workflow_dispatch: null
push:
branches:
- main
Expand All @@ -21,6 +21,7 @@ jobs:
- uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm
- name: cache node modules
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
with:
Expand All @@ -45,4 +46,6 @@ jobs:
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
color: failure
text: The last Algolia workflow run for ${{github.repository}} failed. Search actions for `workflow:Algolia`
text:
The last Algolia workflow run for ${{github.repository}} failed. Search
actions for `workflow:Algolia`
7 changes: 5 additions & 2 deletions .github/workflows/sync-single-english-algolia-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
node-version: 16.x
cache: npm
- name: cache node modules
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
with:
Expand All @@ -36,14 +37,16 @@ jobs:
${{ runner.os }}-node-
- name: npm ci
run: npm ci
- name: Get version from Algolia label if present; only continue if the label is found.
- name:
Get version from Algolia label if present; only continue if the label is
found.
id: getVersion
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
- if: ${{ steps.getVersion.outputs.versionToSync }}
name: Sync English index for single version
env:
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
LANGUAGE: 'en'
LANGUAGE: "en"
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading