Skip to content

Commit 835494c

Browse files
committed
build: make gha workflows that run on main fork-friendly
Some of these won't work on forks due to missing secrets or use unnecessary compute. An alternative would be to run them if the secret is present, but that seems less explicit as to intent. Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
1 parent b8668d1 commit 835494c

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Install gpg secret key
21+
if: github.repository_owner == 'dependency-check'
2122
id: install-gpg-key
2223
run: |
2324
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import
@@ -65,7 +66,7 @@ jobs:
6566
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
6667
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
6768
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
68-
run: mvn -V -s settings.xml -Prelease clean package verify source:jar javadoc:jar gpg:sign deploy -DreleaseTesting --no-transfer-progress --batch-mode
69+
run: mvn -V -s settings.xml clean package verify source:jar javadoc:jar ${{ steps.install-gpg-key.outcome == 'success' && '-Prelease gpg:sign deploy' || '' }} -DreleaseTesting --no-transfer-progress --batch-mode
6970
- name: SARIF Multitool
7071
uses: microsoft/sarif-actions@v0.2
7172
with:
@@ -108,9 +109,6 @@ jobs:
108109
name: Build and Test Docker
109110
runs-on: ubuntu-latest
110111
needs: build
111-
env:
112-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
113-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
114112
steps:
115113
- name: Checkout code
116114
uses: actions/checkout@v6

.github/workflows/false-positive-cleanup.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
permissions: {}
88
jobs:
99
cleanup:
10+
if: github.repository_owner == 'dependency-check'
1011
permissions:
1112
actions: write # to delete workflow runs
1213

.github/workflows/lock.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515

1616
jobs:
1717
action:
18+
if: github.repository_owner == 'dependency-check'
1819
runs-on: ubuntu-latest
1920
steps:
2021
- uses: dessant/lock-threads@v6

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
jobs:
2020
build:
21+
if: github.repository_owner == 'dependency-check'
2122
name: Build dependency-check
2223
runs-on: ubuntu-latest
2324
steps:

0 commit comments

Comments
 (0)