|
51 | 51 | # Enables cloning the Early Access repo later with the relevant PAT
|
52 | 52 | persist-credentials: 'false'
|
53 | 53 |
|
| 54 | + - name: Figure out which docs-early-access branch to checkout, if internal repo |
| 55 | + if: ${{ github.repository == 'github/docs-internal' }} |
| 56 | + id: check-early-access |
| 57 | + uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d |
| 58 | + env: |
| 59 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 60 | + with: |
| 61 | + github-token: ${{ secrets.DOCUBOT_REPO_PAT }} |
| 62 | + result-encoding: string |
| 63 | + script: | |
| 64 | + // If being run from a PR, this becomes 'my-cool-branch'. |
| 65 | + // If run on main, with the `workflow_dispatch` action for |
| 66 | + // example, the value becomes 'main'. |
| 67 | + const { BRANCH_NAME } = process.env |
| 68 | + try { |
| 69 | + const response = await github.repos.getBranch({ |
| 70 | + owner: 'github', |
| 71 | + repo: 'docs-early-access', |
| 72 | + BRANCH_NAME, |
| 73 | + }) |
| 74 | + console.log(`Using docs-early-access branch called '${BRANCH_NAME}'.`) |
| 75 | + return BRANCH_NAME |
| 76 | + } catch (err) { |
| 77 | + if (err.status === 404) { |
| 78 | + console.log(`There is no docs-early-access branch called '${BRANCH_NAME}' so checking out 'main' instead.`) |
| 79 | + return 'main' |
| 80 | + } |
| 81 | + throw err |
| 82 | + } |
| 83 | +
|
| 84 | + - name: Check out docs-early-access too, if internal repo |
| 85 | + if: ${{ github.repository == 'github/docs-internal' }} |
| 86 | + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 |
| 87 | + with: |
| 88 | + repository: github/docs-early-access |
| 89 | + token: ${{ secrets.DOCUBOT_REPO_PAT }} |
| 90 | + path: docs-early-access |
| 91 | + ref: ${{ steps.check-early-access.outputs.result }} |
| 92 | + |
| 93 | + - name: Merge docs-early-access repo's folders |
| 94 | + run: | |
| 95 | + mv docs-early-access/assets assets/images/early-access |
| 96 | + mv docs-early-access/content content/early-access |
| 97 | + mv docs-early-access/data data/early-access |
| 98 | + rm -r docs-early-access |
| 99 | +
|
54 | 100 | - name: Checkout LFS objects
|
55 | 101 | run: git lfs checkout
|
56 | 102 |
|
@@ -78,13 +124,6 @@ jobs:
|
78 | 124 | - name: Install dependencies
|
79 | 125 | run: npm ci
|
80 | 126 |
|
81 |
| - - name: Clone early access |
82 |
| - if: ${{ github.repository == 'github/docs-internal' }} |
83 |
| - run: script/early-access/clone-for-build.js |
84 |
| - env: |
85 |
| - DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }} |
86 |
| - GIT_BRANCH: ${{ github.head_ref || github.ref }} |
87 |
| - |
88 | 127 | - name: Cache nextjs build
|
89 | 128 | uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
|
90 | 129 | with:
|
|
0 commit comments