Skip to content

Commit 0eec258

Browse files
authored
Fix git branch inconsistencies for Actions (#18309)
* Update workflows to pass appropriate branch name for pull_request events * Update Docker building workflow to check appropriate branch name for pull_request events * Update Windows testing workflow for consistency with non-Windows testing workflow * Reorder if conditional check * Update workflow comment
1 parent 48623dc commit 0eec258

7 files changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/build-docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
jobs:
1515
build:
1616
# Do not run this job for translations PRs
17-
if: ${{ github.ref != 'refs/heads/translations' }}
17+
if: ${{ github.head_ref != 'translations' && github.ref != 'refs/heads/translations' }}
1818

1919
runs-on: ubuntu-latest
2020
steps:

.github/workflows/link-check-dotcom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
# run: npm run heroku-postbuild
4848
# env:
4949
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
50-
# GIT_BRANCH: ${{ github.ref }}
50+
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
5151

5252
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
5353
name: Build

.github/workflows/link-check-ghae.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
# run: npm run heroku-postbuild
4848
# env:
4949
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
50-
# GIT_BRANCH: ${{ github.ref }}
50+
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
5151

5252
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
5353
name: Build

.github/workflows/link-check-ghes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
# run: npm run heroku-postbuild
4848
# env:
4949
# DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
50-
# GIT_BRANCH: ${{ github.ref }}
50+
# GIT_BRANCH: ${{ github.head_ref || github.ref }}
5151

5252
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
5353
name: Build

.github/workflows/test-windows.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# NOTE: Changes to this file should also be applied to './test.yml' and './test-translations.yml'
1+
# NOTE: Changes to this file should also be applied to './test.yml'
22

33
name: Node.js Tests - Windows
44

@@ -8,17 +8,24 @@ on:
88
schedule:
99
- cron: '50 19 * * *' # once a day at 19:50 UTC / 11:50 PST
1010

11+
env:
12+
CI: true
13+
1114
jobs:
1215
test:
1316
runs-on: windows-latest
1417
if: (github.event_name != 'pull_request') || (github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'Windows') || contains(github.event.pull_request.labels.*.name, 'windows')))
18+
timeout-minutes: 60
1519
strategy:
1620
fail-fast: false
1721
matrix:
1822
test-group: [content, graphql, meta, rendering, routing, unit]
1923
steps:
2024
- name: Check out repo
2125
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
26+
with:
27+
# Enables cloning the Early Access repo later with the relevant PAT
28+
persist-credentials: 'false'
2229

2330
- name: Setup node
2431
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
@@ -41,7 +48,15 @@ jobs:
4148
- name: Install dependencies
4249
run: npm ci
4350

44-
- name: Run build script
51+
- if: ${{ github.repository == 'github/docs-internal' }}
52+
name: Clone early access
53+
run: npm run heroku-postbuild
54+
env:
55+
DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
56+
GIT_BRANCH: ${{ github.head_ref || github.ref }}
57+
58+
- if: ${{ github.repository != 'github/docs-internal' }}
59+
name: Run build script
4560
run: npm run build
4661

4762
- name: Run tests

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
run: npm run heroku-postbuild
7878
env:
7979
DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
80-
GIT_BRANCH: ${{ github.ref }}
80+
GIT_BRANCH: ${{ github.head_ref || github.ref }}
8181

8282
- if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' && github.repository != 'github/docs-internal' }}
8383
name: Run build script

script/early-access/clone-for-build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require('dotenv').config()
1212
const {
1313
DOCUBOT_REPO_PAT,
1414
HEROKU_PRODUCTION_APP,
15-
GIT_BRANCH // Set by the deployer with the name of the docs-internal branch
15+
GIT_BRANCH // Set by Actions and/or the deployer with the name of the docs-internal branch
1616
} = process.env
1717

1818
// Exit if PAT is not found

0 commit comments

Comments
 (0)