Skip to content

Commit 1d16a68

Browse files
committed
Avoid trying to upload when dealing with PR forks
This should avoid the current "Analysis configuration not found" errors.
1 parent de21053 commit 1d16a68

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/scorecard-scanner.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# yamllint disable rule:line-length
16+
1517
name: Scorecard analysis
1618
run-name: Run Scorecard scanner for security best practices
1719

@@ -62,24 +64,25 @@ jobs:
6264
persist-credentials: false
6365

6466
- name: Run Scorecard analysis
65-
# yamllint disable rule:line-length
6667
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
6768
with:
6869
# Save the results
6970
results_file: scorecard-results.sarif
7071
results_format: sarif
71-
# See https://github.com/ossf/scorecard-action#publishing-results.
72-
publish_results: true
72+
# Only publish results for non-fork PRs or scheduled runs.
73+
publish_results: >-
74+
${{github.event_name != 'pull_request'
75+
|| github.event.pull_request.head.repo.fork == false}}
7376
7477
- name: Upload results to code-scanning dashboard
75-
# yamllint disable rule:line-length
78+
# Skip upload for fork PRs to avoid "Analysis configuration not found" / 404 errors.
79+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
7680
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
7781
with:
7882
sarif_file: scorecard-results.sarif
7983

8084
- if: github.event.inputs.debug == true || runner.debug == true
8185
name: Upload results as artifacts to the workflow Summary page
82-
# yamllint disable rule:line-length
8386
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
8487
with:
8588
name: Scorecard SARIF file

0 commit comments

Comments
 (0)