Skip to content

Commit

Permalink
Don't fail upload if hook is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmelon54 committed Jan 19, 2025
1 parent 34ccdd8 commit 0506ff2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package hook

import (
"github.com/cyphar/filepath-securejoin"
"os"
"os/exec"
"path/filepath"
)
Expand All @@ -28,6 +29,16 @@ func (h *Hook) Run(site, branch string) error {
if err != nil {
return err
}

// check if the script exists before failing to execute
_, err = os.Stat(scriptPath)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}

cmd := exec.Cmd{
Path: scriptPath,
Args: []string{filepath.Base(scriptPath)},
Expand Down

0 comments on commit 0506ff2

Please sign in to comment.