Skip to content

Commit ebd1291

Browse files
committed
GitHub actions: when dependabot, don't publish artefacts
1 parent 33cc470 commit ebd1291

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/bob/build.go

+9
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,18 @@ func buildEntry() *cobra.Command {
477477
}
478478

479479
publishArtefacts, err := func() (bool, error) {
480+
// https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#responding-to-events
481+
isDependabot := os.Getenv("GITHUB_ACTOR") == "dependabot[bot]"
482+
480483
event := os.Getenv("GITHUB_EVENT_NAME")
481484
switch event {
482485
case "push":
486+
if isDependabot { // one would imagine these would be PR events, but dependabot can cause pushes too ..
487+
// .. and as such shouldn't cause artefacts to be published (secrets aren't even accessible,
488+
// and publishing often requires secrets)
489+
return false, nil
490+
}
491+
483492
return true, nil
484493
case "pull_request": // PRs don't publish artefacts
485494
return false, nil

0 commit comments

Comments
 (0)