@@ -16,6 +16,7 @@ dir="$(dirname "$0")"
1616gitactionDir=.github
1717gitactionConfigRoot=/workflows/.gitaction.yml
1818gitactionConfig=$gitactionDir$gitactionConfigRoot
19+ gitactionPRConfig=$gitactionDir /workflows/.gitaction-pr.yml
1920gitactionBuildScript=$gitactionDir /build.sh
2021gitactionSettingsFile=$gitactionDir /settings.xml
2122gitactionNotifyScript=$gitactionDir /notify.sh
@@ -116,19 +117,55 @@ process() {
116117
117118 test -e " $gitactionDir " -a ! -d " $gitactionDir " && die " $gitactionDir is not a directory"
118119 test -e " $gitactionConfig " -a ! -f " $gitactionConfig " && die " $gitactionConfig is not a regular file"
120+ test -e " $gitactionPRConfig " -a ! -f " $gitactionPRConfig " && die " $gitactionPRConfig is not a regular file"
119121 test -e " $gitactionConfig " && warn " $gitactionConfig already exists"
120122 test -e " $gitactionBuildScript " && warn " $gitactionBuildScript already exists"
121123
122124 # -- Do things --
123125
124- # Add/update the GitHun Actions configuration file.
126+ # Add/update the main GitHun Actions configuration file.
125127 cat > " $tmpFile " << EOL
126128name: SciJava CI
127129
128130on:
129131 push:
130132 branches:
131133 - $defaultBranch
134+
135+ jobs:
136+ build:
137+ runs-on: ubuntu-latest
138+
139+ steps:
140+ - uses: actions/checkout@v2
141+
142+ - name: Cache m2 modules
143+ uses: actions/cache@v2
144+ env:
145+ cache-name: cache-node-modules
146+ with:
147+ path: ~/.m2
148+ key: \$ {{ runner.os }}-build-\$ {{ env.cache-name }}
149+ restore-keys: |
150+ \$ {{ runner.os }}-build-\$ {{ env.cache-name }}-
151+ \$ {{ runner.os }}-build-
152+ \$ {{ runner.os }}-
153+
154+ - name: Set up JDK 8
155+ uses: actions/setup-java@v2
156+ with:
157+ java-version: '8'
158+ distribution: 'zulu'
159+ - name: Build with Maven
160+ run: ./$gitactionBuildScript
161+ EOL
162+ update " $gitactionConfig "
163+
164+ # Add/update the GitHun Actions PR configuration file.
165+ cat > " $tmpFile " << EOL
166+ name: SciJava PR CI
167+
168+ on:
132169 pull_request:
133170 branches:
134171 - $defaultBranch
@@ -159,8 +196,10 @@ jobs:
159196 distribution: 'zulu'
160197 - name: Build with Maven
161198 run: ./$gitactionBuildScript
199+ env:
200+ FROM_PR: true
162201EOL
163- update " $gitactionConfig "
202+ update " $gitactionPRConfig "
164203
165204 # Add/update the GitHub Action build script.
166205 cat > " $tmpFile " << EOL
0 commit comments