Skip to content

Commit db3e392

Browse files
committed
Only run the GitHub Actions workflow on the Adafruit repository.
1 parent bd46e5e commit db3e392

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/workflow.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,23 @@ on:
88
- cron: 0 10 * * *
99

1010
jobs:
11+
check-repo-owner:
12+
# This job is so the entire workflow will end successfully and give some
13+
# output to explain why it hasn't run on a non-Adafruit fork.
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: repository
17+
env:
18+
OWNER_IS_ADAFRUIT: ${{ startswith(github.repository, 'adafruit') }}
19+
run: |
20+
echo "This workflow will only run if Adafruit is the repository owner."
21+
echo "Repository owner is Adafruit: $OWNER_IS_ADAFRUIT"
1122
build:
1223
runs-on: ubuntu-latest
24+
# Only run the build on Adafruit's repository. Forks won't have the secrets.
25+
# Its necessary to do this here, since 'schedule' events cannot (currently)
26+
# be limited (they run on all forks' default branches).
27+
if: startswith(github.repository, 'adafruit')
1328
steps:
1429
- uses: actions/checkout@v1
1530
with:

0 commit comments

Comments
 (0)