diff --git a/.github/workflows/element-web.yaml b/.github/workflows/element-web.yaml index 022c293abe..e08803c216 100644 --- a/.github/workflows/element-web.yaml +++ b/.github/workflows/element-web.yaml @@ -15,10 +15,11 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true + env: - # These must be set for fetchdep.sh to get the right branch - REPOSITORY: ${{ github.repository }} + # fetchdep.sh needs to know our PR number PR_NUMBER: ${{ github.event.pull_request.number }} + jobs: build: name: "Build Element-Web" diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml index b95fc3b1c8..c4bf0ef3be 100644 --- a/.github/workflows/static_analysis.yaml +++ b/.github/workflows/static_analysis.yaml @@ -10,10 +10,11 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true + env: - # These must be set for fetchdep.sh to get the right branch - REPOSITORY: ${{ github.repository }} + # fetchdep.sh needs to know our PR number PR_NUMBER: ${{ github.event.pull_request.number }} + jobs: ts_lint: name: "Typescript Syntax Check" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bdc1badd6a..ad8fdab8c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,11 +20,12 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true + env: ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }} - # These must be set for fetchdep.sh to get the right branch - REPOSITORY: ${{ github.repository }} + # fetchdep.sh needs to know our PR number PR_NUMBER: ${{ github.event.pull_request.number }} + jobs: jest: name: Jest diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index 81f0784ff9..3a8b9be4dd 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -10,8 +10,15 @@ defbranch="$3" rm -r "$defrepo" || true -PR_ORG=${PR_ORG:-"matrix-org"} -PR_REPO=${PR_REPO:-"matrix-react-sdk"} +# figure out where to look for pull requests: +# - 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 clone() {