diff --git a/code/hsec-sync/test/Spec/SyncSpec.hs b/code/hsec-sync/test/Spec/SyncSpec.hs index 1abbfe2a..93c64679 100644 --- a/code/hsec-sync/test/Spec/SyncSpec.hs +++ b/code/hsec-sync/test/Spec/SyncSpec.hs @@ -3,9 +3,11 @@ module Spec.SyncSpec (spec) where +import Control.Monad (unless) import Data.Bifunctor (first) import Security.Advisories.Sync import qualified System.Directory as D +import System.Environment (lookupEnv) import System.Exit (ExitCode (ExitSuccess)) import System.FilePath (()) import System.IO.Temp (withSystemTempDirectory) @@ -22,8 +24,11 @@ spec = [ testCase "Invalid root should fail" $ do let repo = withRepositoryAt "/dev/advisories" status repo >>= (@?= DirectoryMissing) - result <- sync repo - first (const ("" :: String)) result @?= Left "" + isGitHubActionRunner <- lookupEnv "GITHUB_ACTIONS" + unless (isGitHubActionRunner == Just "true") $ do + -- GitHub Action runners let you write anywhere + result <- sync repo + first (const ("" :: String)) result @?= Left "" status repo >>= (@?= DirectoryMissing), testCase "Subdirectory creation should work" $ withSystemTempDirectory "hsec-sync" $ \p -> do