Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 192e6f6

Browse files
authored
Fix PR lookup for fetchdep.sh (#10990)
Context: `fetchdep.sh` attempts to check out a github repository based on the details in a pull request. To do this, it needs to know how to find the pull request. So, the github workflows attempt to set environment variables to tell it. Unfortunately, they currently disagree about what the names of the environment variables should be. This appears to have been introduced by #8498. To simplify matters, we may as well have the script use `${GITHUB_REPOSITORY}` directly, and remove te unused `REPOSITORY` env var from the workflows.
1 parent 8abe392 commit 192e6f6

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

.github/workflows/element-web.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ on:
1515
concurrency:
1616
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1717
cancel-in-progress: true
18+
1819
env:
19-
# These must be set for fetchdep.sh to get the right branch
20-
REPOSITORY: ${{ github.repository }}
20+
# fetchdep.sh needs to know our PR number
2121
PR_NUMBER: ${{ github.event.pull_request.number }}
22+
2223
jobs:
2324
build:
2425
name: "Build Element-Web"

.github/workflows/static_analysis.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1212
cancel-in-progress: true
13+
1314
env:
14-
# These must be set for fetchdep.sh to get the right branch
15-
REPOSITORY: ${{ github.repository }}
15+
# fetchdep.sh needs to know our PR number
1616
PR_NUMBER: ${{ github.event.pull_request.number }}
17+
1718
jobs:
1819
ts_lint:
1920
name: "Typescript Syntax Check"

.github/workflows/tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ on:
2020
concurrency:
2121
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
2222
cancel-in-progress: true
23+
2324
env:
2425
ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }}
25-
# These must be set for fetchdep.sh to get the right branch
26-
REPOSITORY: ${{ github.repository }}
26+
# fetchdep.sh needs to know our PR number
2727
PR_NUMBER: ${{ github.event.pull_request.number }}
28+
2829
jobs:
2930
jest:
3031
name: Jest

scripts/fetchdep.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ defbranch="$3"
1010

1111
rm -r "$defrepo" || true
1212

13-
PR_ORG=${PR_ORG:-"matrix-org"}
14-
PR_REPO=${PR_REPO:-"matrix-react-sdk"}
13+
# figure out where to look for pull requests:
14+
# - We may have been told an explicit repo via the PR_ORG/PR_REPO/PR_NUMBER env vars
15+
# - otherwise, check the $GITHUB_ env vars which are set by Github Actions
16+
# - failing that, fall back to the matrix-org/matrix-react-sdk repo.
17+
#
18+
# in ether case, the PR_NUMBER variable must be set explicitly.
19+
default_org_repo=${GITHUB_REPOSITORY:-"matrix-org/matrix-react-sdk"}
20+
PR_ORG=${PR_ORG:-${default_org_repo%%/*}}
21+
PR_REPO=${PR_REPO:-${default_org_repo##*/}}
1522

1623
# A function that clones a branch of a repo based on the org, repo and branch
1724
clone() {

0 commit comments

Comments
 (0)