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.
pull/28217/head
Richard van der Hoff 2023-05-25 14:50:17 +01:00 committed by GitHub
parent 8abe392294
commit 192e6f6c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 8 deletions

View File

@ -15,10 +15,11 @@ on:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true cancel-in-progress: true
env: env:
# These must be set for fetchdep.sh to get the right branch # fetchdep.sh needs to know our PR number
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
jobs: jobs:
build: build:
name: "Build Element-Web" name: "Build Element-Web"

View File

@ -10,10 +10,11 @@ on:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true cancel-in-progress: true
env: env:
# These must be set for fetchdep.sh to get the right branch # fetchdep.sh needs to know our PR number
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
jobs: jobs:
ts_lint: ts_lint:
name: "Typescript Syntax Check" name: "Typescript Syntax Check"

View File

@ -20,11 +20,12 @@ on:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true cancel-in-progress: true
env: env:
ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }} ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }}
# These must be set for fetchdep.sh to get the right branch # fetchdep.sh needs to know our PR number
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
jobs: jobs:
jest: jest:
name: Jest name: Jest

View File

@ -10,8 +10,15 @@ defbranch="$3"
rm -r "$defrepo" || true rm -r "$defrepo" || true
PR_ORG=${PR_ORG:-"matrix-org"} # figure out where to look for pull requests:
PR_REPO=${PR_REPO:-"matrix-react-sdk"} # - We may have been told an explicit repo via the PR_ORG/PR_REPO/PR_NUMBER env vars
# - otherwise, check the $GITHUB_ env vars which are set by Github Actions
# - failing that, fall back to the matrix-org/matrix-react-sdk repo.
#
# in ether case, the PR_NUMBER variable must be set explicitly.
default_org_repo=${GITHUB_REPOSITORY:-"matrix-org/matrix-react-sdk"}
PR_ORG=${PR_ORG:-${default_org_repo%%/*}}
PR_REPO=${PR_REPO:-${default_org_repo##*/}}
# A function that clones a branch of a repo based on the org, repo and branch # A function that clones a branch of a repo based on the org, repo and branch
clone() { clone() {