Composite action to pull in docs-early-access (#34879)
This commit is contained in:
46
.github/workflows/azure-preview-env-deploy.yml
vendored
46
.github/workflows/azure-preview-env-deploy.yml
vendored
@@ -47,9 +47,9 @@ jobs:
|
||||
# See https://bit.ly/3qB9nZW > If a job in a workflow is skipped due to a conditional, it will report its status as "Success".
|
||||
if: |
|
||||
(
|
||||
(github.event.pull_request.head.sha || github.event.inputs.COMMIT_REF)
|
||||
(github.event.pull_request.head.sha || github.event.inputs.COMMIT_REF)
|
||||
&& (github.event.number || github.event.inputs.PR_NUMBER || github.run_id)
|
||||
)
|
||||
)
|
||||
&& (github.repository == 'github/docs-internal' || github.repository == 'github/docs')
|
||||
&& github.actor != 'dependabot[bot]'
|
||||
timeout-minutes: 15
|
||||
@@ -110,48 +110,10 @@ jobs:
|
||||
# Image tag is unique to each workflow run so that it always triggers a new deployment
|
||||
echo "DOCKER_IMAGE=${{ secrets.NONPROD_REGISTRY_SERVER }}/${IMAGE_REPO}:${{ env.COMMIT_REF }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
|
||||
|
||||
- if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
|
||||
name: Determine which docs-early-access branch to clone
|
||||
id: 'check-early-access'
|
||||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
|
||||
env:
|
||||
BRANCH_NAME: ${{ env.BRANCH_NAME }}
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
|
||||
with:
|
||||
github-token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
result-encoding: string
|
||||
script: |
|
||||
const { BRANCH_NAME } = process.env
|
||||
|
||||
try {
|
||||
const { status } = await github.request('GET /repos/{owner}/{repo}/branches/{branch}', {
|
||||
owner: 'github',
|
||||
repo: 'docs-early-access',
|
||||
branch: BRANCH_NAME,
|
||||
})
|
||||
|
||||
if (status !== 200) {
|
||||
throw new Error('Received non-200 response from branch GET request')
|
||||
}
|
||||
|
||||
console.log(`Using docs-early-access branch '${BRANCH_NAME}'`)
|
||||
return BRANCH_NAME
|
||||
} catch (e) {
|
||||
console.log(`Failed to get docs-early-access branch '${BRANCH_NAME}', 'main' will be used instead.`)
|
||||
return 'main'
|
||||
}
|
||||
|
||||
- if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
|
||||
name: Clone docs-early-access
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: ${{ steps.check-early-access.outputs.result }}
|
||||
|
||||
- if: ${{ env.IS_INTERNAL_BUILD == 'true' }}
|
||||
name: Merge docs-early-access repo's folders
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
- if: ${{ env.IS_PUBLIC_BUILD == 'true' }}
|
||||
name: Check out user code to temp directory
|
||||
|
||||
@@ -61,15 +61,9 @@ jobs:
|
||||
node-version-file: 'package.json'
|
||||
cache: npm
|
||||
|
||||
- name: Clone docs-early-access
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
- uses: ./.github/actions/clone-translations
|
||||
with:
|
||||
|
||||
@@ -79,16 +79,9 @@ jobs:
|
||||
node-version-file: 'package.json'
|
||||
cache: npm
|
||||
|
||||
- name: Clone docs-early-access
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: main
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
- name: 'Build and push image'
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
||||
|
||||
5
.github/workflows/browser-test.yml
vendored
5
.github/workflows/browser-test.yml
vendored
@@ -65,6 +65,11 @@ jobs:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
|
||||
run: npm ci --include=optional
|
||||
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
with:
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
|
||||
- name: Cache nextjs build
|
||||
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
||||
with:
|
||||
|
||||
@@ -44,19 +44,12 @@ jobs:
|
||||
# To prevent issues with cloning early access content later
|
||||
persist-credentials: 'false'
|
||||
|
||||
- name: Clone docs-early-access
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: main
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
- uses: ./.github/actions/node-npm-setup
|
||||
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
with:
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
|
||||
- name: Build server
|
||||
run: npm run build
|
||||
|
||||
|
||||
18
.github/workflows/link-check-daily.yml
vendored
18
.github/workflows/link-check-daily.yml
vendored
@@ -27,26 +27,10 @@ jobs:
|
||||
|
||||
- uses: ./.github/actions/node-npm-setup
|
||||
|
||||
- name: Figure out which docs-early-access branch to checkout, if internal repo
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
id: check-early-access
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
run: node .github/actions-scripts/what-docs-early-access-branch.js
|
||||
|
||||
- name: Check out docs-early-access too, if internal repo
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: ${{ steps.check-early-access.outputs.branch }}
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
- name: Restore disk-cache file for external link checking
|
||||
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
|
||||
|
||||
18
.github/workflows/link-check-on-pr.yml
vendored
18
.github/workflows/link-check-on-pr.yml
vendored
@@ -30,26 +30,10 @@ jobs:
|
||||
|
||||
- uses: ./.github/actions/node-npm-setup
|
||||
|
||||
- name: Figure out which docs-early-access branch to checkout, if internal repo
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
id: check-early-access
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
run: node .github/actions-scripts/what-docs-early-access-branch.js
|
||||
|
||||
- name: Check out docs-early-access too, if internal repo
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: ${{ steps.check-early-access.outputs.branch }}
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
# TODO: When we want to fix redirects on changed files we can uncomment everything below
|
||||
# Creates file "${{ env.HOME }}/files.json", among others
|
||||
|
||||
12
.github/workflows/main-preview-docker-cache.yml
vendored
12
.github/workflows/main-preview-docker-cache.yml
vendored
@@ -50,18 +50,10 @@ jobs:
|
||||
# To prevent issues with cloning early access content later
|
||||
persist-credentials: 'false'
|
||||
|
||||
- if: ${{ env.ENABLE_EARLY_ACCESS }}
|
||||
name: Clone docs-early-access
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ env.ENABLE_EARLY_ACCESS }}
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: main
|
||||
|
||||
- if: ${{ env.ENABLE_EARLY_ACCESS }}
|
||||
name: Merge docs-early-access repo's folders
|
||||
run: .github/actions-scripts/merge-early-access.sh
|
||||
|
||||
# In addition to making the final image smaller, we also save time by not sending unnecessary files to the docker build context
|
||||
- name: 'Prune for preview env'
|
||||
|
||||
20
.github/workflows/test.yml
vendored
20
.github/workflows/test.yml
vendored
@@ -88,28 +88,10 @@ jobs:
|
||||
|
||||
- uses: ./.github/actions/node-npm-setup
|
||||
|
||||
- name: Figure out which docs-early-access branch to checkout, if internal repo
|
||||
- uses: ./.github/actions/get-docs-early-access
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
id: check-early-access
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
run: node .github/actions-scripts/what-docs-early-access-branch.js
|
||||
|
||||
- name: Check out docs-early-access too, if internal repo
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
||||
with:
|
||||
repository: github/docs-early-access
|
||||
token: ${{ secrets.DOCUBOT_REPO_PAT }}
|
||||
path: docs-early-access
|
||||
ref: ${{ steps.check-early-access.outputs.branch }}
|
||||
|
||||
- name: Merge docs-early-access repo's folders
|
||||
if: ${{ github.repository == 'github/docs-internal' }}
|
||||
run: |
|
||||
.github/actions-scripts/merge-early-access.sh
|
||||
rm -fr docs-early-access
|
||||
|
||||
- name: Check the test fixture data (if applicable)
|
||||
if: ${{ matrix.test-group == 'rendering-fixtures' }}
|
||||
|
||||
Reference in New Issue
Block a user