Skip to content

Commit cbad91e

Browse files
authored
Fix CI for forks (#3226)
* Try with a different condition for forks * Skip danger in forks, the fallback token won't let it write comments in PRs anyway
1 parent a27d276 commit cbad91e

File tree

9 files changed

+25
-23
lines changed

9 files changed

+25
-23
lines changed

.github/workflows/build_enterprise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Build Enterprise APKs
1818
runs-on: ubuntu-latest
1919
# Skip in forks
20-
if: github.repository == 'element-hq/element-x-android'
20+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
2121
strategy:
2222
matrix:
2323
variant: [debug, release, nightly]

.github/workflows/danger.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
name: Danger main check
9+
# Skip in forks, it doesn't work even with the fallback token
10+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
911
steps:
1012
- uses: actions/checkout@v4
1113
- name: Add SSH private keys for submodule repositories
1214
uses: webfactory/[email protected]
13-
if: github.repository == 'element-hq/element-x-android'
1415
with:
1516
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
1617
- name: Clone submodules
17-
if: github.repository == 'element-hq/element-x-android'
18+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
1819
run: git submodule update --init --recursive
1920
- run: |
2021
npm install --save-dev @babel/plugin-transform-flow-strip-types

.github/workflows/generate_github_pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
generate-github-pages:
1010
runs-on: ubuntu-latest
1111
# Skip in forks
12-
if: github.repository == 'element-hq/element-x-android'
12+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
1313
steps:
1414
- name: ⏬ Checkout with LFS
1515
uses: nschloe/[email protected]

.github/workflows/gradle-wrapper-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Update Gradle Wrapper
1313
uses: gradle-update/update-gradle-wrapper-action@v1
1414
# Skip in forks
15-
if: github.repository == 'element-hq/element-x-android'
15+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
target-branch: develop

.github/workflows/quality.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- name: Add SSH private keys for submodule repositories
2222
uses: webfactory/[email protected]
23-
if: github.repository == 'element-hq/element-x-android'
23+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
2424
with:
2525
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
2626
- name: Clone submodules
27-
if: github.repository == 'element-hq/element-x-android'
27+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
2828
run: git submodule update --init --recursive
2929
- name: Run code quality check suite
3030
run: ./tools/check/check_code_quality.sh
@@ -78,11 +78,11 @@ jobs:
7878
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
7979
- name: Add SSH private keys for submodule repositories
8080
uses: webfactory/[email protected]
81-
if: github.repository == 'element-hq/element-x-android'
81+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
8282
with:
8383
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
8484
- name: Clone submodules
85-
if: github.repository == 'element-hq/element-x-android'
85+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
8686
run: git submodule update --init --recursive
8787
- name: Use JDK 17
8888
uses: actions/setup-java@v4
@@ -118,11 +118,11 @@ jobs:
118118
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
119119
- name: Add SSH private keys for submodule repositories
120120
uses: webfactory/[email protected]
121-
if: github.repository == 'element-hq/element-x-android'
121+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
122122
with:
123123
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
124124
- name: Clone submodules
125-
if: github.repository == 'element-hq/element-x-android'
125+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
126126
run: git submodule update --init --recursive
127127
- name: Use JDK 17
128128
uses: actions/setup-java@v4
@@ -162,11 +162,11 @@ jobs:
162162
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
163163
- name: Add SSH private keys for submodule repositories
164164
uses: webfactory/[email protected]
165-
if: github.repository == 'element-hq/element-x-android'
165+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
166166
with:
167167
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
168168
- name: Clone submodules
169-
if: github.repository == 'element-hq/element-x-android'
169+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
170170
run: git submodule update --init --recursive
171171
- name: Use JDK 17
172172
uses: actions/setup-java@v4
@@ -202,11 +202,11 @@ jobs:
202202
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
203203
- name: Add SSH private keys for submodule repositories
204204
uses: webfactory/[email protected]
205-
if: github.repository == 'element-hq/element-x-android'
205+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
206206
with:
207207
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
208208
- name: Clone submodules
209-
if: github.repository == 'element-hq/element-x-android'
209+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
210210
run: git submodule update --init --recursive
211211
- name: Use JDK 17
212212
uses: actions/setup-java@v4
@@ -242,11 +242,11 @@ jobs:
242242
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
243243
- name: Add SSH private keys for submodule repositories
244244
uses: webfactory/[email protected]
245-
if: github.repository == 'element-hq/element-x-android'
245+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
246246
with:
247247
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
248248
- name: Clone submodules
249-
if: github.repository == 'element-hq/element-x-android'
249+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
250250
run: git submodule update --init --recursive
251251
- name: Use JDK 17
252252
uses: actions/setup-java@v4
@@ -277,6 +277,7 @@ jobs:
277277
name: Project Check Suite
278278
runs-on: ubuntu-latest
279279
needs: [konsist, lint, ktlint, detekt]
280+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
280281
steps:
281282
- uses: actions/checkout@v4
282283
with:

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ jobs:
4242
enterprise:
4343
name: Create App Bundle Enterprise
4444
runs-on: ubuntu-latest
45-
if: github.repository == 'element-hq/element-x-android'
45+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
4646
concurrency:
4747
group: ${{ format('build-release-main-gplay-{0}', github.sha) }}
4848
cancel-in-progress: true
4949
steps:
5050
- uses: actions/checkout@v4
5151
- name: Add SSH private keys for submodule repositories
5252
uses: webfactory/[email protected]
53-
if: github.repository == 'element-hq/element-x-android'
53+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
5454
with:
5555
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
5656
- name: Clone submodules

.github/workflows/sync-localazy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
sync-localazy:
1010
runs-on: ubuntu-latest
1111
# Skip in forks
12-
if: github.repository == 'element-hq/element-x-android'
12+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
1313
steps:
1414
- uses: actions/checkout@v4
1515
- name: Use JDK 17

.github/workflows/sync-sas-strings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
sync-sas-strings:
1010
runs-on: ubuntu-latest
1111
# Skip in forks
12-
if: github.repository == 'element-hq/element-x-android'
12+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
1313
# No concurrency required, runs every time on a schedule.
1414
steps:
1515
- uses: actions/checkout@v4

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
4141
- name: Add SSH private keys for submodule repositories
4242
uses: webfactory/[email protected]
43-
if: github.repository == 'element-hq/element-x-android'
43+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
4444
with:
4545
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
4646
- name: Clone submodules
47-
if: github.repository == 'element-hq/element-x-android'
47+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
4848
run: git submodule update --init --recursive
4949
- name: ☕️ Use JDK 17
5050
uses: actions/setup-java@v4

0 commit comments

Comments
 (0)