From 91b9f67acb5fae55903bda6ecc2f14818443b2fd Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Tue, 22 Jun 2021 12:23:25 +0300 Subject: [PATCH 01/34] Implement actions->artifacts API. --- fixtures/actions/artifacts-list.json | 29 +++++++ github.cabal | 4 + spec/GitHub/ActionsSpec.hs | 56 +++++++++++++ src/GitHub.hs | 9 +++ src/GitHub/Data.hs | 6 ++ src/GitHub/Data/Actions.hs | 97 +++++++++++++++++++++++ src/GitHub/Endpoints/Actions/Artifacts.hs | 65 +++++++++++++++ 7 files changed, 266 insertions(+) create mode 100644 fixtures/actions/artifacts-list.json create mode 100644 spec/GitHub/ActionsSpec.hs create mode 100644 src/GitHub/Data/Actions.hs create mode 100644 src/GitHub/Endpoints/Actions/Artifacts.hs diff --git a/fixtures/actions/artifacts-list.json b/fixtures/actions/artifacts-list.json new file mode 100644 index 00000000..94cf8978 --- /dev/null +++ b/fixtures/actions/artifacts-list.json @@ -0,0 +1,29 @@ +{ + "artifacts": [ + { + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186197/zip", + "created_at": "2021-06-21T11:44:28Z", + "expired": false, + "expires_at": "2021-09-19T11:42:51Z", + "id": 69186197, + "name": "doc-html", + "node_id": "MDg6QXJ0aWZhY3Q2OTE4NjE5Nw==", + "size_in_bytes": 53023433, + "updated_at": "2021-06-21T11:44:29Z", + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186197" + }, + { + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186115/zip", + "created_at": "2021-06-21T11:44:01Z", + "expired": false, + "expires_at": "2021-09-19T11:43:05Z", + "id": 69186115, + "name": "doc-html", + "node_id": "MDg6QXJ0aWZhY3Q2OTE4NjExNQ==", + "size_in_bytes": 56038290, + "updated_at": "2021-06-21T11:44:01Z", + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186115" + } + ], + "total_count": 13676 +} \ No newline at end of file diff --git a/github.cabal b/github.cabal index 348a9345..19d5ee8f 100644 --- a/github.cabal +++ b/github.cabal @@ -43,6 +43,7 @@ tested-with: extra-source-files: README.md CHANGELOG.md + fixtures/actions/artifacts-list.json fixtures/issue-search.json fixtures/list-teams.json fixtures/members-list.json @@ -85,6 +86,7 @@ library GitHub GitHub.Auth GitHub.Data + GitHub.Data.Actions GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -116,6 +118,7 @@ library GitHub.Data.URL GitHub.Data.Webhooks GitHub.Data.Webhooks.Validate + GitHub.Endpoints.Actions.Artifacts GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring @@ -219,6 +222,7 @@ test-suite github-test build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.8 other-extensions: TemplateHaskell other-modules: + GitHub.ActionsSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/spec/GitHub/ActionsSpec.hs b/spec/GitHub/ActionsSpec.hs new file mode 100644 index 00000000..0727ac1f --- /dev/null +++ b/spec/GitHub/ActionsSpec.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.ActionsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.Either.Compat (isRight) +import Data.FileEmbed (embedFile) +import Data.Foldable (for_) +import Data.String (fromString) +import qualified Data.Vector as V +import System.Environment (lookupEnv) +import Test.Hspec + (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +withAuth :: (GH.Auth -> IO ()) -> IO () +withAuth action = do + mtoken <- lookupEnv "GITHUB_TOKEN" + case mtoken of + Nothing -> pendingWith "no GITHUB_TOKEN" + Just token -> action (GH.OAuth $ fromString token) + +spec :: Spec +spec = do + describe "artifactsForR" $ do + it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do + cs <- GH.executeRequest auth $ + GH.artifactsForR owner repo GH.FetchAll + cs `shouldSatisfy` isRight + + describe "decoding artifacts payloads" $ do + it "decodes artifacts list payload" $ do + GH.withTotalCountTotalCount artifactList `shouldBe` 13676 + V.length (GH.withTotalCountItems artifactList) `shouldBe` 2 + + where + repos = + [ ("thoughtbot", "paperclip") + , ("phadej", "github") + ] + + artifactList :: GH.WithTotalCount GH.Artifact + artifactList = + fromRightS (eitherDecodeStrict artifactsListPayload) + + artifactsListPayload :: ByteString + artifactsListPayload = $(embedFile "fixtures/actions/artifacts-list.json") diff --git a/src/GitHub.hs b/src/GitHub.hs index 6b5f8d36..4180ca46 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -413,6 +413,14 @@ module GitHub ( -- | See rateLimitR, + -- ** Actions + -- | See + artifactsForR, + artifactR, + deleteArtifactR, + downloadArtifactR, + artifactsForWorkflowRunR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -420,6 +428,7 @@ module GitHub ( ) where import GitHub.Data +import GitHub.Endpoints.Actions.Artifacts import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 6b475d40..f7f65b76 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -19,6 +19,7 @@ module GitHub.Data ( mkCommitName, fromUserName, fromOrganizationName, + mkWorkflowRunId, -- ** Id Id, mkId, @@ -34,6 +35,7 @@ module GitHub.Data ( IssueNumber (..), -- * Module re-exports module GitHub.Auth, + module GitHub.Data.Actions, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -67,6 +69,7 @@ import GitHub.Internal.Prelude import Prelude () import GitHub.Auth +import GitHub.Data.Actions import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content @@ -141,3 +144,6 @@ fromOrganizationId = Id . untagId fromUserId :: Id User -> Id Owner fromUserId = Id . untagId + +mkWorkflowRunId :: Int -> Id WorkflowRun +mkWorkflowRunId = Id diff --git a/src/GitHub/Data/Actions.hs b/src/GitHub/Data/Actions.hs new file mode 100644 index 00000000..efd2464b --- /dev/null +++ b/src/GitHub/Data/Actions.hs @@ -0,0 +1,97 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +module GitHub.Data.Actions ( + Artifact(..), + ArtifactList(..), + Workflow, + PaginatedWithTotalCount(..), + WithTotalCount(..), + WorkflowRun, + ) where + +import GHC.TypeLits +import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) +import GitHub.Internal.Prelude +import Prelude () + +import Data.Data (Proxy (..)) +import qualified Data.Text as T + +data Artifact = Artifact + { artifactArchiveDownloadUrl :: !URL + , artifactCreatedAt :: !UTCTime + , artifactExpired :: !Bool + , artifactExpiresAt :: !UTCTime + , artifactId :: !(Id Artifact) + , artifactName :: !Text + , artifactNodeId :: !Text + , artifactSizeInBytes :: !Int + , artifactUpdatedAt :: !UTCTime + , artifactUrl :: !URL + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data ArtifactList = ArtifactList + { artifactListArtifacts :: !(Vector Artifact) + , artifactListTotalCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount + { paginatedWithTotalCountItems :: !(Vector a) + , paginatedWithTotalCountTotalCount :: !Int + } + +data WithTotalCount a = WithTotalCount + { withTotalCountItems :: !(Vector a) + , withTotalCountTotalCount :: !Int + } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance Semigroup (WithTotalCount a) where + (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = + WithTotalCount (items1 <> items2) count1 + +instance Foldable WithTotalCount where + foldMap f (WithTotalCount items _) = foldMap f items + +data Workflow +data WorkflowRun + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON Artifact where + parseJSON = withObject "Artifact" $ \o -> Artifact + <$> o .: "archive_download_url" + <*> o .: "created_at" + <*> o .: "expired" + <*> o .: "expires_at" + <*> o .: "id" + <*> o .: "name" + <*> o .: "node_id" + <*> o .: "size_in_bytes" + <*> o .: "updated_at" + <*> o .: "url" + +instance FromJSON ArtifactList where + parseJSON = withObject "ArtifactList" $ \o -> ArtifactList + <$> o .: "artifacts" + <*> o .: "total_count" + +instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where + parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount + <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) + <*> o .: "total_count" + +instance FromJSON (WithTotalCount Artifact) where + parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount + <$> o .: "artifacts" + <*> o .: "total_count" diff --git a/src/GitHub/Endpoints/Actions/Artifacts.hs b/src/GitHub/Endpoints/Actions/Artifacts.hs new file mode 100644 index 00000000..833db825 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Artifacts.hs @@ -0,0 +1,65 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The actions API as documented at +-- . +module GitHub.Endpoints.Actions.Artifacts ( + artifactsForR, + artifactR, + deleteArtifactR, + downloadArtifactR, + artifactsForWorkflowRunR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Network.URI (URI) +import Prelude () +-- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) + +-- | List artifacts for repository. +-- See +artifactsForR + :: Name Owner + -> Name Repo + -> FetchCount + -> Request k (WithTotalCount Artifact) +artifactsForR user repo = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] + [] + + +-- | Query a single artifact. +-- See +artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request k Artifact +artifactR user repo artid = + query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] [] + +-- | Delete an artifact. +-- See +deleteArtifactR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW () +deleteArtifactR user repo artid = + Command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] + +-- | Download an artifact. +-- See +downloadArtifactR :: Name Owner -> Name Repo -> Id Artifact -> GenRequest 'MtRedirect 'RW URI +downloadArtifactR user repo artid = + Query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid, "zip"] [] + +-- | List artifacts for a workflow run. +-- See +artifactsForWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> FetchCount + -> Request k (WithTotalCount Artifact) +artifactsForWorkflowRunR user repo runid = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runid, "artifacts"] + [] From f1e951373e7ec7e7f08c0b16c2d917334a6eb61d Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sat, 16 Jul 2022 16:49:40 -0700 Subject: [PATCH 02/34] Up --- .gitignore | 1 + github.cabal | 7 +- hie.yaml | 4 + src/GitHub/Data/Actions.hs | 103 +++++++++++++++--- src/GitHub/Data/Options.hs | 123 ++++++++++++++++++++++ src/GitHub/Endpoints/Actions/Cache.hs | 73 +++++++++++++ src/GitHub/Endpoints/Actions/Workflows.hs | 64 +++++++++++ stack.yaml | 71 +++++++++++++ stack.yaml.lock | 19 ++++ 9 files changed, 445 insertions(+), 20 deletions(-) create mode 100644 hie.yaml create mode 100644 src/GitHub/Endpoints/Actions/Cache.hs create mode 100644 src/GitHub/Endpoints/Actions/Workflows.hs create mode 100644 stack.yaml create mode 100644 stack.yaml.lock diff --git a/.gitignore b/.gitignore index 452bddc6..d335cb9f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ cabal.sandbox.config run.sh src/hightlight.js src/style.css +.DS_Store diff --git a/github.cabal b/github.cabal index 19d5ee8f..d4f63513 100644 --- a/github.cabal +++ b/github.cabal @@ -119,6 +119,7 @@ library GitHub.Data.Webhooks GitHub.Data.Webhooks.Validate GitHub.Endpoints.Actions.Artifacts + GitHub.Endpoints.Actions.Cache GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring @@ -201,9 +202,9 @@ library if flag(openssl) build-depends: - HsOpenSSL >=0.11.4.16 && <0.12 - , HsOpenSSL-x509-system >=0.1.0.3 && <0.2 - , http-client-openssl >=0.2.2.0 && <0.4 + HsOpenSSL >=0.11.4.16 && <1.12 + , HsOpenSSL-x509-system >=0.1.0.3 && <1.2 + , http-client-openssl >=0.2.2.0 && <1.4 else build-depends: diff --git a/hie.yaml b/hie.yaml new file mode 100644 index 00000000..0e68b037 --- /dev/null +++ b/hie.yaml @@ -0,0 +1,4 @@ +cradle: + stack: + - path: "./src" + component: "github:lib" diff --git a/src/GitHub/Data/Actions.hs b/src/GitHub/Data/Actions.hs index efd2464b..90b10b0b 100644 --- a/src/GitHub/Data/Actions.hs +++ b/src/GitHub/Data/Actions.hs @@ -13,6 +13,7 @@ module GitHub.Data.Actions ( PaginatedWithTotalCount(..), WithTotalCount(..), WorkflowRun, + Cache(..), ) where import GHC.TypeLits @@ -24,6 +25,32 @@ import Prelude () import Data.Data (Proxy (..)) import qualified Data.Text as T +------------------------------------------------------------------------------- +-- Common +------------------------------------------------------------------------------- + +data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount + { paginatedWithTotalCountItems :: !(Vector a) + , paginatedWithTotalCountTotalCount :: !Int + } + +data WithTotalCount a = WithTotalCount + { withTotalCountItems :: !(Vector a) + , withTotalCountTotalCount :: !Int + } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance Semigroup (WithTotalCount a) where + (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = + WithTotalCount (items1 <> items2) count1 + +instance Foldable WithTotalCount where + foldMap f (WithTotalCount items _) = foldMap f items + + +------------------------------------------------------------------------------- +-- Artifact +------------------------------------------------------------------------------- + data Artifact = Artifact { artifactArchiveDownloadUrl :: !URL , artifactCreatedAt :: !UTCTime @@ -44,23 +71,6 @@ data ArtifactList = ArtifactList } deriving (Show, Data, Typeable, Eq, Ord, Generic) -data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount - { paginatedWithTotalCountItems :: !(Vector a) - , paginatedWithTotalCountTotalCount :: !Int - } - -data WithTotalCount a = WithTotalCount - { withTotalCountItems :: !(Vector a) - , withTotalCountTotalCount :: !Int - } deriving (Show, Data, Typeable, Eq, Ord, Generic) - -instance Semigroup (WithTotalCount a) where - (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = - WithTotalCount (items1 <> items2) count1 - -instance Foldable WithTotalCount where - foldMap f (WithTotalCount items _) = foldMap f items - data Workflow data WorkflowRun @@ -95,3 +105,62 @@ instance FromJSON (WithTotalCount Artifact) where parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount <$> o .: "artifacts" <*> o .: "total_count" + + +------------------------------------------------------------------------------- +-- Cache +------------------------------------------------------------------------------- + +data Cache = Cache + { cacheId :: !(Id Cache) + , cacheRef :: !Text + , cacheKey :: !Text + , cacheVersion :: !Text + , cacheLastAccessedAt :: !UTCTime + , cacheCreatedAt :: !UTCTime + , cacheSizeInBytes :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data CacheList = CacheList +-- { cacheListCaches :: !(Vector Cache) +-- , cacheListTotalCount :: !Int +-- } +-- deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data Workflow +-- data WorkflowRun + +-- ------------------------------------------------------------------------------- +-- -- JSON instances +-- ------------------------------------------------------------------------------- + +instance FromJSON Cache where + parseJSON = withObject "Cache" $ \o -> Cache + <$> o .: "id" + <*> o .: "ref" + <*> o .: "key" + <*> o .: "version" + <*> o .: "last_accessed_at" + <*> o .: "created_at" + <*> o .: "size_in_bytes" + +-- instance FromJSON CacheList where +-- parseJSON = withObject "CacheList" $ \o -> CacheList +-- <$> o .: "actions_caches" +-- <*> o .: "total_count" + +instance FromJSON (WithTotalCount Cache) where + parseJSON = withObject "CacheList" $ \o -> WithTotalCount + <$> o .: "actions_caches" + <*> o .: "total_count" + +-- instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where +-- parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount +-- <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) +-- <*> o .: "total_count" + +-- instance FromJSON (WithTotalCount Artifact) where +-- parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount +-- <$> o .: "artifacts" +-- <*> o .: "total_count" diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 70665317..a4bcfd6b 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE LambdaCase #-} ----------------------------------------------------------------------------- -- | -- License : BSD-3-Clause @@ -44,6 +45,18 @@ module GitHub.Data.Options ( optionsIrrelevantAssignee, optionsAnyAssignee, optionsNoAssignee, + -- * Actions cache + CacheMod, + cacheModToQueryString, + optionsRef, + optionsNoRef, + optionsKey, + optionsNoKey, + optionsDirectionAsc, + optionsDirectionDesc, + sortByCreatedAt, + sortByLastAccessedAt, + sortBySizeInBytes, -- * Data IssueState (..), MergeableState (..), @@ -180,6 +193,18 @@ data FilterBy a deriving (Eq, Ord, Show, Generic, Typeable, Data) +-- Actions cache + +data SortCache + = SortCacheCreatedAt + | SortCacheLastAccessedAt + | SortCacheSizeInBytes + deriving + (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + +instance NFData SortCache where rnf = genericRnf +instance Binary SortCache + ------------------------------------------------------------------------------- -- Classes ------------------------------------------------------------------------------- @@ -607,3 +632,101 @@ optionsAnyAssignee = IssueRepoMod $ \opts -> optionsNoAssignee :: IssueRepoMod optionsNoAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterNone } + +------------------------------------------------------------------------------- +-- Actions cache +------------------------------------------------------------------------------- + +-- | See . +data CacheOptions = CacheOptions + { cacheOptionsRef :: !(Maybe Text) + , cacheOptionsKey :: !(Maybe Text) + , cacheOptionsSort :: !(Maybe SortCache) + , cacheOptionsDirection :: !(Maybe SortDirection) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultCacheOptions :: CacheOptions +defaultCacheOptions = CacheOptions + { cacheOptionsRef = Nothing + , cacheOptionsKey = Nothing + , cacheOptionsSort = Nothing + , cacheOptionsDirection = Nothing + } + +-- | See . +newtype CacheMod = CacheMod (CacheOptions -> CacheOptions) + +instance Semigroup CacheMod where + CacheMod f <> CacheMod g = CacheMod (g . f) + +instance Monoid CacheMod where + mempty = CacheMod id + mappend = (<>) + +toCacheOptions :: CacheMod -> CacheOptions +toCacheOptions (CacheMod f) = f defaultCacheOptions + +cacheModToQueryString :: CacheMod -> QueryString +cacheModToQueryString = cacheOptionsToQueryString . toCacheOptions + +cacheOptionsToQueryString :: CacheOptions -> QueryString +cacheOptionsToQueryString (CacheOptions ref key sort dir) = + catMaybes + [ mk "ref" <$> ref' + , mk "key" <$> key' + , mk "sort" <$> sort' + , mk "directions" <$> direction' + ] + where + mk k v = (k, Just v) + sort' = fmap (\case + SortCacheCreatedAt -> "created_at" + SortCacheLastAccessedAt -> "last_accessed_at" + SortCacheSizeInBytes -> "size_in_bytes") sort + direction' = fmap (\case + SortDescending -> "desc" + SortAscending -> "asc") dir + ref' = fmap TE.encodeUtf8 ref + key' = fmap TE.encodeUtf8 key + +------------------------------------------------------------------------------- +-- Pull request modifiers +------------------------------------------------------------------------------- + +optionsRef :: Text -> CacheMod +optionsRef x = CacheMod $ \opts -> + opts { cacheOptionsRef = Just x } + +optionsNoRef :: CacheMod +optionsNoRef = CacheMod $ \opts -> + opts { cacheOptionsRef = Nothing } + +optionsKey :: Text -> CacheMod +optionsKey x = CacheMod $ \opts -> + opts { cacheOptionsKey = Just x } + +optionsNoKey :: CacheMod +optionsNoKey = CacheMod $ \opts -> + opts { cacheOptionsKey = Nothing } + +optionsDirectionAsc :: CacheMod +optionsDirectionAsc = CacheMod $ \opts -> + opts { cacheOptionsDirection = Just SortAscending } + +optionsDirectionDesc :: CacheMod +optionsDirectionDesc = CacheMod $ \opts -> + opts { cacheOptionsDirection = Just SortDescending } + +sortByCreatedAt :: CacheMod +sortByCreatedAt = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheCreatedAt } + +sortByLastAccessedAt :: CacheMod +sortByLastAccessedAt = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheLastAccessedAt } + +sortBySizeInBytes :: CacheMod +sortBySizeInBytes = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheSizeInBytes } diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs new file mode 100644 index 00000000..24b2e098 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -0,0 +1,73 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The actions API as documented at +-- . +module GitHub.Endpoints.Actions.Cache ( + cachesForRepoR, + deleteCacheR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Network.URI (URI) +import Prelude () +-- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) + +-- -- | List artifacts for repository. +-- -- See +-- artifactsForR +-- :: Name Owner +-- -> Name Repo +-- -> FetchCount +-- -> Request k (WithTotalCount Artifact) +-- artifactsForR user repo = PagedQuery +-- ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] +-- [] + + +-- -- | Query a single artifact. +-- -- See +-- artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request k Artifact +-- artifactR user repo artid = +-- query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] [] + + +-- -- | Download an artifact. +-- -- See +-- downloadArtifactR :: Name Owner -> Name Repo -> Id Artifact -> GenRequest 'MtRedirect 'RW URI +-- downloadArtifactR user repo artid = +-- Query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid, "zip"] [] + +-- | List the GitHub Actions caches for a repository. +-- See +cachesForRepoR + :: Name Owner + -> Name Repo + -> CacheMod + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Cache) +cachesForRepoR user repo opts = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "caches"] + (cacheModToQueryString opts) + +-- | Delete GitHub Actions cache for a repository. +-- See +-- TODO: No querystring for Commands??? +-- TODO: return value +-- deleteCachesKeyR :: Name Owner -> Name Repo -> String -> Maybe String -> GenRequest 'MtUnit 'RW () +-- deleteCachesKeyR user repo key ref = +-- Command Delete parts mempty +-- where +-- parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches"] + +-- | Delete GitHub Actions cache for a repository. +-- See +deleteCacheR :: Name Owner -> Name Repo -> Id Cache -> GenRequest 'MtUnit 'RW () +deleteCacheR user repo cacheid = + Command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches", toPathPart cacheid] \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs new file mode 100644 index 00000000..677c2760 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -0,0 +1,64 @@ +-- ----------------------------------------------------------------------------- +-- -- | +-- -- License : BSD-3-Clause +-- -- Maintainer : Oleg Grenrus +-- -- +-- -- The pull requests API as documented at +-- -- . +-- module GitHub.Endpoints.Actions.Workflows ( +-- workflowsForR, +-- workflowRunsForR, +-- createWorkflowDispatchEventR, +-- workflowRunForR, +-- module GitHub.Data +-- ) where + +-- import GitHub.Data +-- import GitHub.Internal.Prelude +-- import Prelude () +-- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) + +-- -- | List pull requests. +-- -- See +-- workflowsForR +-- :: Name Owner +-- -> Name Repo +-- -- -> FetchCount +-- -> Request k (ActionWorkflowResult ActionWorkflow) +-- workflowsForR user repo = query +-- ["repos", toPathPart user, toPathPart repo, "actions", "workflows"] +-- [] + +-- -- TODO move? +-- -- data Workflow + + +-- workflowRunsForR +-- :: Name Owner +-- -> Name Repo +-- -> Name Workflow +-- -- -> FetchCount +-- -> Request k (ActionWorkflowRunResult ActionWorkflowRun) +-- workflowRunsForR user repo workflowId = query +-- ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflowId, "runs"] +-- [] + +-- -- | Create a pull request. +-- -- See +-- createWorkflowDispatchEventR :: (ToJSON a) => Name Owner +-- -> Name Repo +-- -> Name Workflow +-- -> CreateWorkflowDispatchEvent a +-- -> GenRequest 'MtUnit 'RW () +-- createWorkflowDispatchEventR user repo workflowId cwde = +-- Command Post ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflowId, "dispatches"] (encode cwde) + + +-- workflowRunForR +-- :: Name Owner +-- -> Name Repo +-- -> Id ActionWorkflowRun +-- -> Request k (ActionWorkflowRun) +-- workflowRunForR user repo runId = query +-- ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runId] +-- [] \ No newline at end of file diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 00000000..104a40a0 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,71 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/yaml_configuration/ + +# Resolver to choose a 'specific' stackage snapshot or a compiler version. +# A snapshot resolver dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +resolver: lts-16.27 +# resolver: nightly-2015-09-21 +# resolver: ghc-7.10.2 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# resolver: ./custom-snapshot.yaml +# resolver: https://example.com/snapshots/2018-01-01.yaml +#resolver: +# url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/2.yaml + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# subdirs: +# - auto-update +# - wai +packages: +- . +# Dependency packages to be pulled from upstream that are not in the resolver. +# These entries can reference officially published versions as well as +# forks / in-progress versions pinned to a git hash. For example: +# +# extra-deps: +# - acme-missiles-0.3 +# - git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# +extra-deps: + - binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 + + +# Override default flag values for local packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=2.5" +# +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor +ghc-options: + '$everything': -haddock diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 00000000..6b754f14 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,19 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 + pantry-tree: + size: 1035 + sha256: 05d4c1e47e9550160fd0ebc97de6d5c2ed5b70afdf3aebf79b111bfe52f09b83 + original: + hackage: binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 +snapshots: +- completed: + size: 533252 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/27.yaml + sha256: c2aaae52beeacf6a5727c1010f50e89d03869abfab6d2c2658ade9da8ed50c73 + original: lts-16.27 From b1ab2df600d537e9b4695d3360958e9a801d7bd1 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sat, 16 Jul 2022 17:01:19 -0700 Subject: [PATCH 03/34] Cleanup --- src/GitHub/Data/Actions.hs | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/src/GitHub/Data/Actions.hs b/src/GitHub/Data/Actions.hs index 90b10b0b..615fddc3 100644 --- a/src/GitHub/Data/Actions.hs +++ b/src/GitHub/Data/Actions.hs @@ -8,7 +8,6 @@ {-# LANGUAGE KindSignatures #-} module GitHub.Data.Actions ( Artifact(..), - ArtifactList(..), Workflow, PaginatedWithTotalCount(..), WithTotalCount(..), @@ -65,12 +64,6 @@ data Artifact = Artifact } deriving (Show, Data, Typeable, Eq, Ord, Generic) -data ArtifactList = ArtifactList - { artifactListArtifacts :: !(Vector Artifact) - , artifactListTotalCount :: !Int - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) - data Workflow data WorkflowRun @@ -91,11 +84,6 @@ instance FromJSON Artifact where <*> o .: "updated_at" <*> o .: "url" -instance FromJSON ArtifactList where - parseJSON = withObject "ArtifactList" $ \o -> ArtifactList - <$> o .: "artifacts" - <*> o .: "total_count" - instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) @@ -122,15 +110,6 @@ data Cache = Cache } deriving (Show, Data, Typeable, Eq, Ord, Generic) --- data CacheList = CacheList --- { cacheListCaches :: !(Vector Cache) --- , cacheListTotalCount :: !Int --- } --- deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- data Workflow --- data WorkflowRun - -- ------------------------------------------------------------------------------- -- -- JSON instances -- ------------------------------------------------------------------------------- @@ -145,22 +124,8 @@ instance FromJSON Cache where <*> o .: "created_at" <*> o .: "size_in_bytes" --- instance FromJSON CacheList where --- parseJSON = withObject "CacheList" $ \o -> CacheList --- <$> o .: "actions_caches" --- <*> o .: "total_count" - instance FromJSON (WithTotalCount Cache) where parseJSON = withObject "CacheList" $ \o -> WithTotalCount <$> o .: "actions_caches" <*> o .: "total_count" --- instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where --- parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount --- <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) --- <*> o .: "total_count" - --- instance FromJSON (WithTotalCount Artifact) where --- parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount --- <$> o .: "artifacts" --- <*> o .: "total_count" From d094b172193eefacdd50be7448752ac957469d97 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sat, 16 Jul 2022 19:49:28 -0700 Subject: [PATCH 04/34] Actions - cache. --- src/GitHub/Data/Actions.hs | 30 +++++++++++++++++++ src/GitHub/Endpoints/Actions/Cache.hs | 42 ++++++++++++--------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/src/GitHub/Data/Actions.hs b/src/GitHub/Data/Actions.hs index 615fddc3..6a2b53bc 100644 --- a/src/GitHub/Data/Actions.hs +++ b/src/GitHub/Data/Actions.hs @@ -13,6 +13,8 @@ module GitHub.Data.Actions ( WithTotalCount(..), WorkflowRun, Cache(..), + RepositoryCacheUsage(..), + OrganizationCacheUsage(..), ) where import GHC.TypeLits @@ -110,6 +112,19 @@ data Cache = Cache } deriving (Show, Data, Typeable, Eq, Ord, Generic) +data RepositoryCacheUsage = CacheUsage + { fullName :: !Text + , activeCachesSizeInBytes :: !Int + , activeCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data OrganizationCacheUsage = OrganizationCacheUsage + { totalActiveCachesSizeInBytes :: !Int + , totalActiveCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + -- ------------------------------------------------------------------------------- -- -- JSON instances -- ------------------------------------------------------------------------------- @@ -129,3 +144,18 @@ instance FromJSON (WithTotalCount Cache) where <$> o .: "actions_caches" <*> o .: "total_count" +instance FromJSON OrganizationCacheUsage where + parseJSON = withObject "OrganizationCacheUsage" $ \o -> OrganizationCacheUsage + <$> o .: "total_active_caches_size_in_bytes" + <*> o .: "total_active_caches_count" + +instance FromJSON RepositoryCacheUsage where + parseJSON = withObject "CacheUsage" $ \o -> CacheUsage + <$> o .: "full_name" + <*> o .: "active_caches_size_in_bytes" + <*> o .: "active_caches_count" + +instance FromJSON (WithTotalCount RepositoryCacheUsage) where + parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount + <$> o .: "repository_cache_usages" + <*> o .: "total_count" \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs index 24b2e098..5acbf13b 100644 --- a/src/GitHub/Endpoints/Actions/Cache.hs +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -6,6 +6,9 @@ -- The actions API as documented at -- . module GitHub.Endpoints.Actions.Cache ( + cacheUsageOrganizationR, + cacheUsageByRepositoryR, + cacheUsageR, cachesForRepoR, deleteCacheR, module GitHub.Data @@ -13,34 +16,25 @@ module GitHub.Endpoints.Actions.Cache ( import GitHub.Data import GitHub.Internal.Prelude -import Network.URI (URI) import Prelude () --- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) --- -- | List artifacts for repository. --- -- See --- artifactsForR --- :: Name Owner --- -> Name Repo --- -> FetchCount --- -> Request k (WithTotalCount Artifact) --- artifactsForR user repo = PagedQuery --- ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] --- [] +-- | Get Actions cache usage for the organization. +-- See +cacheUsageOrganizationR :: Name Organization -> GenRequest 'MtJSON 'RA OrganizationCacheUsage +cacheUsageOrganizationR org = + Query ["orgs", toPathPart org, "actions", "cache", "usage"] [] +-- | Get Actions cache usage for the organization. +-- See +cacheUsageByRepositoryR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) +cacheUsageByRepositoryR org = + PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] [] --- -- | Query a single artifact. --- -- See --- artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request k Artifact --- artifactR user repo artid = --- query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] [] - - --- -- | Download an artifact. --- -- See --- downloadArtifactR :: Name Owner -> Name Repo -> Id Artifact -> GenRequest 'MtRedirect 'RW URI --- downloadArtifactR user repo artid = --- Query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid, "zip"] [] +-- | Get Actions cache usage for the repository. +-- See +cacheUsageR :: Name Owner -> Name Repo -> Request k RepositoryCacheUsage +cacheUsageR user repo = + Query ["repos", toPathPart user, toPathPart repo, "actions", "cache", "usage"] [] -- | List the GitHub Actions caches for a repository. -- See From 7b18e83ebef9d0631c65a1a7c5831de34dabbb7f Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 30 Oct 2022 17:06:27 -0700 Subject: [PATCH 05/34] Actions - artifacts and cache. --- fixtures/actions/artifact.json | 20 +++ fixtures/actions/artifacts-list.json | 56 +++--- fixtures/actions/cache-list.json | 15 ++ fixtures/actions/org-cache-usage.json | 4 + fixtures/actions/repo-cache-usage.json | 6 + github.cabal | 7 +- hie.yaml | 2 + .../ArtifactsSpec.hs} | 14 +- spec/GitHub/Actions/CacheSpec.hs | 65 +++++++ src/GitHub/Data.hs | 8 +- src/GitHub/Data/Actions.hs | 161 ------------------ src/GitHub/Data/Actions/Artifacts.hs | 79 +++++++++ src/GitHub/Data/Actions/Cache.hs | 83 +++++++++ src/GitHub/Data/Actions/Common.hs | 51 ++++++ 14 files changed, 383 insertions(+), 188 deletions(-) create mode 100644 fixtures/actions/artifact.json create mode 100644 fixtures/actions/cache-list.json create mode 100644 fixtures/actions/org-cache-usage.json create mode 100644 fixtures/actions/repo-cache-usage.json rename spec/GitHub/{ActionsSpec.hs => Actions/ArtifactsSpec.hs} (79%) create mode 100644 spec/GitHub/Actions/CacheSpec.hs delete mode 100644 src/GitHub/Data/Actions.hs create mode 100644 src/GitHub/Data/Actions/Artifacts.hs create mode 100644 src/GitHub/Data/Actions/Cache.hs create mode 100644 src/GitHub/Data/Actions/Common.hs diff --git a/fixtures/actions/artifact.json b/fixtures/actions/artifact.json new file mode 100644 index 00000000..5d8076b7 --- /dev/null +++ b/fixtures/actions/artifact.json @@ -0,0 +1,20 @@ +{ + "id": 416767789, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3Njc3ODk=", + "name": "dist-without-markdown", + "size_in_bytes": 42718, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789", + "archive_download_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789/zip", + "expired": false, + "created_at": "2022-10-29T22:18:21Z", + "updated_at": "2022-10-29T22:18:23Z", + "expires_at": "2023-01-27T22:18:16Z", + "workflow_run": { + "id": 3353148947, + "repository_id": 559365297, + "head_repository_id": 559365297, + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954" + } + } + \ No newline at end of file diff --git a/fixtures/actions/artifacts-list.json b/fixtures/actions/artifacts-list.json index 94cf8978..2d03d803 100644 --- a/fixtures/actions/artifacts-list.json +++ b/fixtures/actions/artifacts-list.json @@ -1,29 +1,43 @@ { + "total_count": 23809, "artifacts": [ { - "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186197/zip", - "created_at": "2021-06-21T11:44:28Z", - "expired": false, - "expires_at": "2021-09-19T11:42:51Z", - "id": 69186197, + "id": 416737084, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3MzcwODQ=", "name": "doc-html", - "node_id": "MDg6QXJ0aWZhY3Q2OTE4NjE5Nw==", - "size_in_bytes": 53023433, - "updated_at": "2021-06-21T11:44:29Z", - "url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186197" + "size_in_bytes": 61667543, + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084", + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084/zip", + "expired": false, + "created_at": "2022-10-29T20:56:24Z", + "updated_at": "2022-10-29T20:56:25Z", + "expires_at": "2023-01-27T20:50:21Z", + "workflow_run": { + "id": 3352897496, + "repository_id": 81598961, + "head_repository_id": 101955313, + "head_branch": "backport-bfecff5-3.11", + "head_sha": "692cd77975413d71ff0951072df686e6f38711c8" + } }, { - "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186115/zip", - "created_at": "2021-06-21T11:44:01Z", - "expired": false, - "expires_at": "2021-09-19T11:43:05Z", - "id": 69186115, + "id": 416712612, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3MTI2MTI=", "name": "doc-html", - "node_id": "MDg6QXJ0aWZhY3Q2OTE4NjExNQ==", - "size_in_bytes": 56038290, - "updated_at": "2021-06-21T11:44:01Z", - "url": "https://api.github.com/repos/python/cpython/actions/artifacts/69186115" + "size_in_bytes": 61217330, + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612", + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612/zip", + "expired": false, + "created_at": "2022-10-29T19:53:19Z", + "updated_at": "2022-10-29T19:53:20Z", + "expires_at": "2023-01-27T19:49:12Z", + "workflow_run": { + "id": 3352724493, + "repository_id": 81598961, + "head_repository_id": 559335486, + "head_branch": "patch-1", + "head_sha": "62eb88a66d1d35f7701873d8b698a2f8d7e84fa5" + } } - ], - "total_count": 13676 -} \ No newline at end of file + ] +} diff --git a/fixtures/actions/cache-list.json b/fixtures/actions/cache-list.json new file mode 100644 index 00000000..7e0cf3a6 --- /dev/null +++ b/fixtures/actions/cache-list.json @@ -0,0 +1,15 @@ +{ + "total_count": 1, + "actions_caches": [ + { + "id": 1, + "ref": "refs/heads/main", + "key": "cache_key", + "version": "f5f850afdadd47730296d4ffa900de95f6bbafb75dc1e8475df1fa6ae79dcece", + "last_accessed_at": "2022-10-30T00:08:14.223333300Z", + "created_at": "2022-10-30T00:08:14.223333300Z", + "size_in_bytes": 26586 + } + ] +} + \ No newline at end of file diff --git a/fixtures/actions/org-cache-usage.json b/fixtures/actions/org-cache-usage.json new file mode 100644 index 00000000..c1822137 --- /dev/null +++ b/fixtures/actions/org-cache-usage.json @@ -0,0 +1,4 @@ +{ + "total_active_caches_size_in_bytes": 26586, + "total_active_caches_count": 1 +} diff --git a/fixtures/actions/repo-cache-usage.json b/fixtures/actions/repo-cache-usage.json new file mode 100644 index 00000000..d5194b49 --- /dev/null +++ b/fixtures/actions/repo-cache-usage.json @@ -0,0 +1,6 @@ +{ + "full_name": "python/cpython", + "active_caches_size_in_bytes": 55000268087, + "active_caches_count": 171 +} + \ No newline at end of file diff --git a/github.cabal b/github.cabal index d4f63513..34408605 100644 --- a/github.cabal +++ b/github.cabal @@ -86,7 +86,9 @@ library GitHub GitHub.Auth GitHub.Data - GitHub.Data.Actions + GitHub.Data.Actions.Common + GitHub.Data.Actions.Artifacts + GitHub.Data.Actions.Cache GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -223,7 +225,8 @@ test-suite github-test build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.8 other-extensions: TemplateHaskell other-modules: - GitHub.ActionsSpec + GitHub.Actions.ArtifactsSpec + GitHub.Actions.CacheSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/hie.yaml b/hie.yaml index 0e68b037..7ed87dfe 100644 --- a/hie.yaml +++ b/hie.yaml @@ -2,3 +2,5 @@ cradle: stack: - path: "./src" component: "github:lib" + - path: "./spec" + component: "github-test" diff --git a/spec/GitHub/ActionsSpec.hs b/spec/GitHub/Actions/ArtifactsSpec.hs similarity index 79% rename from spec/GitHub/ActionsSpec.hs rename to spec/GitHub/Actions/ArtifactsSpec.hs index 0727ac1f..db5fe077 100644 --- a/spec/GitHub/ActionsSpec.hs +++ b/spec/GitHub/Actions/ArtifactsSpec.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} -module GitHub.ActionsSpec where +module GitHub.Actions.ArtifactsSpec where import qualified GitHub as GH @@ -39,8 +39,11 @@ spec = do describe "decoding artifacts payloads" $ do it "decodes artifacts list payload" $ do - GH.withTotalCountTotalCount artifactList `shouldBe` 13676 + GH.withTotalCountTotalCount artifactList `shouldBe` 23809 V.length (GH.withTotalCountItems artifactList) `shouldBe` 2 + it "decodes signle artifact payload" $ do + GH.artifactName artifact `shouldBe` "dist-without-markdown" + GH.workflowRunHeadSha (GH.workflowRun artifact) `shouldBe` "601593ecb1d8a57a04700fdb445a28d4186b8954" where repos = @@ -52,5 +55,12 @@ spec = do artifactList = fromRightS (eitherDecodeStrict artifactsListPayload) + artifact :: GH.Artifact + artifact = + fromRightS (eitherDecodeStrict artifactPayload) + artifactsListPayload :: ByteString artifactsListPayload = $(embedFile "fixtures/actions/artifacts-list.json") + + artifactPayload :: ByteString + artifactPayload = $(embedFile "fixtures/actions/artifact.json") \ No newline at end of file diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs new file mode 100644 index 00000000..9da89d5a --- /dev/null +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -0,0 +1,65 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.CacheSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.Either.Compat (isRight) +import Data.FileEmbed (embedFile) +import Data.Foldable (for_) +import Data.String (fromString) +import qualified Data.Vector as V +import System.Environment (lookupEnv) +import Test.Hspec + (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +withAuth :: (GH.Auth -> IO ()) -> IO () +withAuth action = do + mtoken <- lookupEnv "GITHUB_TOKEN" + case mtoken of + Nothing -> pendingWith "no GITHUB_TOKEN" + Just token -> action (GH.OAuth $ fromString token) + +spec :: Spec +spec = do + describe "decoding cache payloads" $ do + it "decodes cache list payload" $ do + V.length (GH.withTotalCountItems cacheList) `shouldBe` 1 + it "decodes cache usage for repo" $ do + GH.repositoryCacheUsageFullName repoCacheUsage `shouldBe` "python/cpython" + GH.repositoryCacheUsageActiveCachesSizeInBytes repoCacheUsage `shouldBe` 55000268087 + GH.repositoryCacheUsageActiveCachesCount repoCacheUsage `shouldBe` 171 + it "decodes cache usage for org" $ do + GH.organizationCacheUsageTotalActiveCachesSizeInBytes orgCacheUsage `shouldBe` 26586 + GH.organizationCacheUsageTotalActiveCachesCount orgCacheUsage `shouldBe` 1 + + where + cacheList :: GH.WithTotalCount GH.Cache + cacheList = + fromRightS (eitherDecodeStrict cacheListPayload) + + repoCacheUsage :: GH.RepositoryCacheUsage + repoCacheUsage = + fromRightS (eitherDecodeStrict repoCacheUsagePayload) + + orgCacheUsage :: GH.OrganizationCacheUsage + orgCacheUsage = + fromRightS (eitherDecodeStrict orgCacheUsagePayload) + + cacheListPayload :: ByteString + cacheListPayload = $(embedFile "fixtures/actions/cache-list.json") + + repoCacheUsagePayload :: ByteString + repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") + + orgCacheUsagePayload :: ByteString + orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") \ No newline at end of file diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index f7f65b76..b983eb11 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -35,7 +35,9 @@ module GitHub.Data ( IssueNumber (..), -- * Module re-exports module GitHub.Auth, - module GitHub.Data.Actions, + module GitHub.Data.Actions.Common, + module GitHub.Data.Actions.Artifacts, + module GitHub.Data.Actions.Cache, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -69,7 +71,9 @@ import GitHub.Internal.Prelude import Prelude () import GitHub.Auth -import GitHub.Data.Actions +import GitHub.Data.Actions.Common +import GitHub.Data.Actions.Artifacts +import GitHub.Data.Actions.Cache import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content diff --git a/src/GitHub/Data/Actions.hs b/src/GitHub/Data/Actions.hs deleted file mode 100644 index 6a2b53bc..00000000 --- a/src/GitHub/Data/Actions.hs +++ /dev/null @@ -1,161 +0,0 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE KindSignatures #-} -module GitHub.Data.Actions ( - Artifact(..), - Workflow, - PaginatedWithTotalCount(..), - WithTotalCount(..), - WorkflowRun, - Cache(..), - RepositoryCacheUsage(..), - OrganizationCacheUsage(..), - ) where - -import GHC.TypeLits -import GitHub.Data.Id (Id) -import GitHub.Data.URL (URL) -import GitHub.Internal.Prelude -import Prelude () - -import Data.Data (Proxy (..)) -import qualified Data.Text as T - -------------------------------------------------------------------------------- --- Common -------------------------------------------------------------------------------- - -data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount - { paginatedWithTotalCountItems :: !(Vector a) - , paginatedWithTotalCountTotalCount :: !Int - } - -data WithTotalCount a = WithTotalCount - { withTotalCountItems :: !(Vector a) - , withTotalCountTotalCount :: !Int - } deriving (Show, Data, Typeable, Eq, Ord, Generic) - -instance Semigroup (WithTotalCount a) where - (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = - WithTotalCount (items1 <> items2) count1 - -instance Foldable WithTotalCount where - foldMap f (WithTotalCount items _) = foldMap f items - - -------------------------------------------------------------------------------- --- Artifact -------------------------------------------------------------------------------- - -data Artifact = Artifact - { artifactArchiveDownloadUrl :: !URL - , artifactCreatedAt :: !UTCTime - , artifactExpired :: !Bool - , artifactExpiresAt :: !UTCTime - , artifactId :: !(Id Artifact) - , artifactName :: !Text - , artifactNodeId :: !Text - , artifactSizeInBytes :: !Int - , artifactUpdatedAt :: !UTCTime - , artifactUrl :: !URL - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) - -data Workflow -data WorkflowRun - -------------------------------------------------------------------------------- --- JSON instances -------------------------------------------------------------------------------- - -instance FromJSON Artifact where - parseJSON = withObject "Artifact" $ \o -> Artifact - <$> o .: "archive_download_url" - <*> o .: "created_at" - <*> o .: "expired" - <*> o .: "expires_at" - <*> o .: "id" - <*> o .: "name" - <*> o .: "node_id" - <*> o .: "size_in_bytes" - <*> o .: "updated_at" - <*> o .: "url" - -instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where - parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount - <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) - <*> o .: "total_count" - -instance FromJSON (WithTotalCount Artifact) where - parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount - <$> o .: "artifacts" - <*> o .: "total_count" - - -------------------------------------------------------------------------------- --- Cache -------------------------------------------------------------------------------- - -data Cache = Cache - { cacheId :: !(Id Cache) - , cacheRef :: !Text - , cacheKey :: !Text - , cacheVersion :: !Text - , cacheLastAccessedAt :: !UTCTime - , cacheCreatedAt :: !UTCTime - , cacheSizeInBytes :: !Int - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) - -data RepositoryCacheUsage = CacheUsage - { fullName :: !Text - , activeCachesSizeInBytes :: !Int - , activeCachesCount :: !Int - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) - -data OrganizationCacheUsage = OrganizationCacheUsage - { totalActiveCachesSizeInBytes :: !Int - , totalActiveCachesCount :: !Int - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- ------------------------------------------------------------------------------- --- -- JSON instances --- ------------------------------------------------------------------------------- - -instance FromJSON Cache where - parseJSON = withObject "Cache" $ \o -> Cache - <$> o .: "id" - <*> o .: "ref" - <*> o .: "key" - <*> o .: "version" - <*> o .: "last_accessed_at" - <*> o .: "created_at" - <*> o .: "size_in_bytes" - -instance FromJSON (WithTotalCount Cache) where - parseJSON = withObject "CacheList" $ \o -> WithTotalCount - <$> o .: "actions_caches" - <*> o .: "total_count" - -instance FromJSON OrganizationCacheUsage where - parseJSON = withObject "OrganizationCacheUsage" $ \o -> OrganizationCacheUsage - <$> o .: "total_active_caches_size_in_bytes" - <*> o .: "total_active_caches_count" - -instance FromJSON RepositoryCacheUsage where - parseJSON = withObject "CacheUsage" $ \o -> CacheUsage - <$> o .: "full_name" - <*> o .: "active_caches_size_in_bytes" - <*> o .: "active_caches_count" - -instance FromJSON (WithTotalCount RepositoryCacheUsage) where - parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount - <$> o .: "repository_cache_usages" - <*> o .: "total_count" \ No newline at end of file diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs new file mode 100644 index 00000000..d11f64b3 --- /dev/null +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -0,0 +1,79 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +module GitHub.Data.Actions.Artifacts ( + Artifact(..), + WorkflowRun(..), + ) where + +import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Repos (Repo) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) + + +------------------------------------------------------------------------------- +-- Artifact +------------------------------------------------------------------------------- +data WorkflowRun = WorkflowRun + { workflowRunWorkflowRunId :: !(Id WorkflowRun) + , workflowRunRepositoryId :: !(Id Repo) + , workflowRunHeadRepositoryId :: !(Id Repo) + , workflowRunHeadBranch :: !Text + , workflowRunHeadSha :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data Artifact = Artifact + { artifactArchiveDownloadUrl :: !URL + , artifactCreatedAt :: !UTCTime + , artifactExpired :: !Bool + , artifactExpiresAt :: !UTCTime + , artifactId :: !(Id Artifact) + , artifactName :: !Text + , artifactNodeId :: !Text + , artifactSizeInBytes :: !Int + , artifactUpdatedAt :: !UTCTime + , artifactUrl :: !URL + , workflowRun :: !WorkflowRun + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON WorkflowRun where + parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun + <$> o .: "id" + <*> o .: "repository_id" + <*> o .: "head_repository_id" + <*> o .: "head_branch" + <*> o .: "head_sha" + +instance FromJSON Artifact where + parseJSON = withObject "Artifact" $ \o -> Artifact + <$> o .: "archive_download_url" + <*> o .: "created_at" + <*> o .: "expired" + <*> o .: "expires_at" + <*> o .: "id" + <*> o .: "name" + <*> o .: "node_id" + <*> o .: "size_in_bytes" + <*> o .: "updated_at" + <*> o .: "url" + <*> o .: "workflow_run" + +instance FromJSON (WithTotalCount Artifact) where + parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount + <$> o .: "artifacts" + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs new file mode 100644 index 00000000..fc6c0134 --- /dev/null +++ b/src/GitHub/Data/Actions/Cache.hs @@ -0,0 +1,83 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +module GitHub.Data.Actions.Cache ( + Cache(..), + RepositoryCacheUsage(..), + OrganizationCacheUsage(..) + ) where + +import GitHub.Data.Id (Id) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) + + +------------------------------------------------------------------------------- +-- Cache +------------------------------------------------------------------------------- + +data Cache = Cache + { cacheId :: !(Id Cache) + , cacheRef :: !Text + , cacheKey :: !Text + , cacheVersion :: !Text + , cacheLastAccessedAt :: !UTCTime + , cacheCreatedAt :: !UTCTime + , cacheSizeInBytes :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RepositoryCacheUsage = RepositoryCacheUsage + { repositoryCacheUsageFullName :: !Text + , repositoryCacheUsageActiveCachesSizeInBytes :: !Int + , repositoryCacheUsageActiveCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data OrganizationCacheUsage = OrganizationCacheUsage + { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int + , organizationCacheUsageTotalActiveCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- ------------------------------------------------------------------------------- +-- -- JSON instances +-- ------------------------------------------------------------------------------- + +instance FromJSON Cache where + parseJSON = withObject "Cache" $ \o -> Cache + <$> o .: "id" + <*> o .: "ref" + <*> o .: "key" + <*> o .: "version" + <*> o .: "last_accessed_at" + <*> o .: "created_at" + <*> o .: "size_in_bytes" + +instance FromJSON (WithTotalCount Cache) where + parseJSON = withObject "CacheList" $ \o -> WithTotalCount + <$> o .: "actions_caches" + <*> o .: "total_count" + +instance FromJSON OrganizationCacheUsage where + parseJSON = withObject "OrganizationCacheUsage" $ \o -> OrganizationCacheUsage + <$> o .: "total_active_caches_size_in_bytes" + <*> o .: "total_active_caches_count" + +instance FromJSON RepositoryCacheUsage where + parseJSON = withObject "RepositoryCacheUsage" $ \o -> RepositoryCacheUsage + <$> o .: "full_name" + <*> o .: "active_caches_size_in_bytes" + <*> o .: "active_caches_count" + +instance FromJSON (WithTotalCount RepositoryCacheUsage) where + parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount + <$> o .: "repository_cache_usages" + <*> o .: "total_count" \ No newline at end of file diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs new file mode 100644 index 00000000..ed935639 --- /dev/null +++ b/src/GitHub/Data/Actions/Common.hs @@ -0,0 +1,51 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +module GitHub.Data.Actions.Common ( + PaginatedWithTotalCount(..), + WithTotalCount(..), + ) where + + +import GHC.TypeLits +import GitHub.Internal.Prelude +import Prelude () + +import Data.Data (Proxy (..)) +import qualified Data.Text as T + +------------------------------------------------------------------------------- +-- Common +------------------------------------------------------------------------------- + +data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount + { paginatedWithTotalCountItems :: !(Vector a) + , paginatedWithTotalCountTotalCount :: !Int + } + +data WithTotalCount a = WithTotalCount + { withTotalCountItems :: !(Vector a) + , withTotalCountTotalCount :: !Int + } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance Semigroup (WithTotalCount a) where + (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = + WithTotalCount (items1 <> items2) count1 + +instance Foldable WithTotalCount where + foldMap f (WithTotalCount items _) = foldMap f items + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + + +instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where + parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount + <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) + <*> o .: "total_count" From 9cf8f3b878d960c2ac4ff28de44afabce7ffd4a1 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Fri, 11 Nov 2022 15:07:17 -0800 Subject: [PATCH 06/34] Secrets --- fixtures/actions/org-public-key.json | 5 + fixtures/actions/org-secret.json | 7 + fixtures/actions/org-secrets-list.json | 19 +++ .../selected-repositories-for-secret.json | 73 +++++++++ github.cabal | 3 + spec/GitHub/Actions/CacheSpec.hs | 7 - spec/GitHub/Actions/SecretsSpec.hs | 58 +++++++ src/GitHub/Data.hs | 2 + src/GitHub/Data/Actions/Secrets.hs | 127 +++++++++++++++ src/GitHub/Endpoints/Actions/Secrets.hs | 153 ++++++++++++++++++ 10 files changed, 447 insertions(+), 7 deletions(-) create mode 100644 fixtures/actions/org-public-key.json create mode 100644 fixtures/actions/org-secret.json create mode 100644 fixtures/actions/org-secrets-list.json create mode 100644 fixtures/actions/selected-repositories-for-secret.json create mode 100644 spec/GitHub/Actions/SecretsSpec.hs create mode 100644 src/GitHub/Data/Actions/Secrets.hs create mode 100644 src/GitHub/Endpoints/Actions/Secrets.hs diff --git a/fixtures/actions/org-public-key.json b/fixtures/actions/org-public-key.json new file mode 100644 index 00000000..7624898e --- /dev/null +++ b/fixtures/actions/org-public-key.json @@ -0,0 +1,5 @@ +{ + "key_id": "568250167242549743", + "key": "KHVvOxB765kjkShEgUu27QCzl5XxKz/L20V+KRsWf0w=" +} + \ No newline at end of file diff --git a/fixtures/actions/org-secret.json b/fixtures/actions/org-secret.json new file mode 100644 index 00000000..bf6f795f --- /dev/null +++ b/fixtures/actions/org-secret.json @@ -0,0 +1,7 @@ +{ + "name": "TEST_SECRET", + "created_at": "2022-10-31T00:08:12Z", + "updated_at": "2022-10-31T00:08:12Z", + "visibility": "all" +} + \ No newline at end of file diff --git a/fixtures/actions/org-secrets-list.json b/fixtures/actions/org-secrets-list.json new file mode 100644 index 00000000..5e1e079f --- /dev/null +++ b/fixtures/actions/org-secrets-list.json @@ -0,0 +1,19 @@ +{ + "total_count": 2, + "secrets": [ + { + "name": "TEST_SECRET", + "created_at": "2022-10-31T00:08:12Z", + "updated_at": "2022-10-31T00:08:12Z", + "visibility": "all" + }, + { + "name": "TEST_SELECTED", + "created_at": "2022-10-31T00:08:43Z", + "updated_at": "2022-10-31T00:08:43Z", + "visibility": "selected", + "selected_repositories_url": "https://api.github.com/orgs/kote-test-org-actions/actions/secrets/TEST_SELECTED/repositories" + } + ] +} + \ No newline at end of file diff --git a/fixtures/actions/selected-repositories-for-secret.json b/fixtures/actions/selected-repositories-for-secret.json new file mode 100644 index 00000000..815dd413 --- /dev/null +++ b/fixtures/actions/selected-repositories-for-secret.json @@ -0,0 +1,73 @@ +{ + "total_count": 1, + "repositories": [ + { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + ] +} + \ No newline at end of file diff --git a/github.cabal b/github.cabal index 34408605..886803db 100644 --- a/github.cabal +++ b/github.cabal @@ -89,6 +89,7 @@ library GitHub.Data.Actions.Common GitHub.Data.Actions.Artifacts GitHub.Data.Actions.Cache + GitHub.Data.Actions.Secrets GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -122,6 +123,7 @@ library GitHub.Data.Webhooks.Validate GitHub.Endpoints.Actions.Artifacts GitHub.Endpoints.Actions.Cache + GitHub.Endpoints.Actions.Secrets GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring @@ -227,6 +229,7 @@ test-suite github-test other-modules: GitHub.Actions.ArtifactsSpec GitHub.Actions.CacheSpec + GitHub.Actions.SecretsSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs index 9da89d5a..54d37527 100644 --- a/spec/GitHub/Actions/CacheSpec.hs +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -22,13 +22,6 @@ fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a -withAuth :: (GH.Auth -> IO ()) -> IO () -withAuth action = do - mtoken <- lookupEnv "GITHUB_TOKEN" - case mtoken of - Nothing -> pendingWith "no GITHUB_TOKEN" - Just token -> action (GH.OAuth $ fromString token) - spec :: Spec spec = do describe "decoding cache payloads" $ do diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs new file mode 100644 index 00000000..14ea521d --- /dev/null +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -0,0 +1,58 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.SecretsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.Either.Compat (isRight) +import Data.FileEmbed (embedFile) +import Data.Foldable (for_) +import Data.String (fromString) +import qualified Data.Vector as V +import System.Environment (lookupEnv) +import Test.Hspec + (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding secrets payloads" $ do + it "decodes selected repo list payload" $ do + V.length (GH.withTotalCountItems repoList) `shouldBe` 1 + -- it "decodes cache usage for repo" $ do + -- GH.repositoryCacheUsageFullName repoCacheUsage `shouldBe` "python/cpython" + -- GH.repositoryCacheUsageActiveCachesSizeInBytes repoCacheUsage `shouldBe` 55000268087 + -- GH.repositoryCacheUsageActiveCachesCount repoCacheUsage `shouldBe` 171 + -- it "decodes cache usage for org" $ do + -- GH.organizationCacheUsageTotalActiveCachesSizeInBytes orgCacheUsage `shouldBe` 26586 + -- GH.organizationCacheUsageTotalActiveCachesCount orgCacheUsage `shouldBe` 1 + + where + repoList :: GH.WithTotalCount GH.SelectedRepo + repoList = + fromRightS (eitherDecodeStrict repoListPayload) + + -- repoCacheUsage :: GH.RepositoryCacheUsage + -- repoCacheUsage = + -- fromRightS (eitherDecodeStrict repoCacheUsagePayload) + + -- orgCacheUsage :: GH.OrganizationCacheUsage + -- orgCacheUsage = + -- fromRightS (eitherDecodeStrict orgCacheUsagePayload) + + repoListPayload :: ByteString + repoListPayload = $(embedFile "fixtures/actions/selected-repositories-for-secret.json") + + -- repoCacheUsagePayload :: ByteString + -- repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") + + -- orgCacheUsagePayload :: ByteString + -- orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") \ No newline at end of file diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index b983eb11..75d9664b 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -38,6 +38,7 @@ module GitHub.Data ( module GitHub.Data.Actions.Common, module GitHub.Data.Actions.Artifacts, module GitHub.Data.Actions.Cache, + module GitHub.Data.Actions.Secrets, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -73,6 +74,7 @@ import Prelude () import GitHub.Auth import GitHub.Data.Actions.Common import GitHub.Data.Actions.Artifacts +import GitHub.Data.Actions.Secrets import GitHub.Data.Actions.Cache import GitHub.Data.Activities import GitHub.Data.Comments diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs new file mode 100644 index 00000000..cc7cbdea --- /dev/null +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -0,0 +1,127 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RecordWildCards #-} +module GitHub.Data.Actions.Secrets ( + Secret(..), + PublicKey(..), + SetSecret(..), + SelectedRepo(..), + SetSelectedRepositories(..), + RepoSecret(..), + Environment(..), + ) where + +import GitHub.Data.Id (Id) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Name (Name) +import GitHub.Data.Repos (Repo) +import Data.Maybe (maybeToList) + + +------------------------------------------------------------------------------- +-- Secret +------------------------------------------------------------------------------- + +data Secret = Secret + { secretNmae :: !(Name Secret) + , secretCreatedAt :: !UTCTime + , secretUpdatedAt :: !UTCTime + , secretVisibility :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data PublicKey = PublicKey + { publicKeyId :: !(Id PublicKey) + , publicKeyKey :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SetSecret = SetSecret + { setSecretPublicKeyId :: !(Id PublicKey) + , setSecretEncryptedValue :: !Text + , setSecretVisibility :: !Text + , setSecretSelectedRepositoryIds :: !(Maybe [Id Repo]) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SelectedRepo = SelectedRepo + { selectedRepoRepoId :: !(Id Repo) + , selectedRepoRepoName :: !(Name Repo) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SetSelectedRepositories = SetSelectedRepositories + { setSelectedRepositoriesRepositoryIds :: ![Id Repo] + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RepoSecret = RepoSecret + { repoSecretNmae :: !(Name Secret) + , repoSecretCreatedAt :: !UTCTime + , repoSecretUpdatedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- TODO move somewhere else? +data Environment = Environment + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- ------------------------------------------------------------------------------- +-- -- JSON instances +-- ------------------------------------------------------------------------------- + +instance FromJSON Secret where + parseJSON = withObject "Secret" $ \o -> Secret + <$> o .: "name" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "visibility" + +instance FromJSON (WithTotalCount Secret) where + parseJSON = withObject "SecretList" $ \o -> WithTotalCount + <$> o .: "secrets" + <*> o .: "total_count" + +instance FromJSON PublicKey where + parseJSON = withObject "PublicKey" $ \o -> PublicKey + <$> o .: "key_id" + <*> o .: "key" + +instance FromJSON SelectedRepo where + parseJSON = withObject "SelectedRepo" $ \o -> SelectedRepo + <$> o .: "id" + <*> o .: "name" + +instance ToJSON SetSelectedRepositories where + toJSON SetSelectedRepositories{..} = + object + [ "selected_repository_ids" .= setSelectedRepositoriesRepositoryIds + ] + +instance ToJSON SetSecret where + toJSON SetSecret{..} = + object $ + [ "encrypted_value" .= setSecretEncryptedValue + , "key_id" .= setSecretPublicKeyId + , "visibility" .= setSecretVisibility + ] <> maybeToList (fmap ("selected_repository_ids" .=) setSecretSelectedRepositoryIds) + +instance FromJSON (WithTotalCount SelectedRepo) where + parseJSON = withObject "SelectedRepoList" $ \o -> WithTotalCount + <$> o .: "repositories" + <*> o .: "total_count" + +instance FromJSON RepoSecret where + parseJSON = withObject "RepoSecret" $ \o -> RepoSecret + <$> o .: "name" + <*> o .: "created_at" + <*> o .: "updated_at" \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs new file mode 100644 index 00000000..d2b8ff27 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -0,0 +1,153 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The actions API as documented at +-- . +module GitHub.Endpoints.Actions.Secrets ( + organizationSecretsR, + organizationPublicKeyR, + organizationSecretR, + setOrganizationSecretR, + deleteOrganizationSecretR, + organizationSelectedRepositoriesForSecretR, + setOrganizationSelectedRepositoriesForSecretR, + addOrganizationSelectedRepositoriesForSecretR, + removeOrganizationSelectedRepositoriesForSecretR, + repoSecretsR, + repoPublicKeyR, + repoSecretR, + setRepoSecretR, + deleteRepoSecretR, + environmentSecretsR, + environmentPublicKeyR, + environmentSecretR, + setEnvironmentSecretR, + deleteEnvironmentSecretR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | List organization secrets. +-- See +organizationSecretsR :: Name Organization -> GenRequest 'MtJSON 'RA (WithTotalCount Secret) +organizationSecretsR org = + Query ["orgs", toPathPart org, "actions", "secrets"] [] + +-- | List organization secrets. +-- See +organizationPublicKeyR :: Name Organization -> GenRequest 'MtJSON 'RA PublicKey +organizationPublicKeyR org = + Query ["orgs", toPathPart org, "actions", "secrets", "public-key"] [] + +-- | Get an organization secret. +-- See +organizationSecretR :: Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA Secret +organizationSecretR org name = + Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name] [] + +-- | Create or update an organization secret. +-- See +setOrganizationSecretR :: Name Organization -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setOrganizationSecretR org name = + command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode + +-- | Delete an organization secret. +-- See +deleteOrganizationSecretR :: Name Organization -> Name Secret -> Request 'RW () +deleteOrganizationSecretR org name = + command Delete parts mempty + where + parts = ["orgs", toPathPart org, "actions", "secrets", toPathPart name] + +-- | Get selected repositories for an organization secret. +-- See +organizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) +organizationSelectedRepositoriesForSecretR org name = + Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] + +-- | Set selected repositories for an organization secret. +-- See +setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> SetSelectedRepositories -> GenRequest 'MtJSON 'RW () +setOrganizationSelectedRepositoriesForSecretR org name = + command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode + +-- | Add selected repository to an organization secret. +-- See +addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> Id Repo -> GenRequest 'MtJSON 'RW () +addOrganizationSelectedRepositoriesForSecretR org name repo = + command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + +-- | Remove selected repository from an organization secret. +-- See +removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> Id Repo -> GenRequest 'MtJSON 'RW () +removeOrganizationSelectedRepositoriesForSecretR org name repo = + command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + +-- | List repository secrets. +-- See +repoSecretsR :: Name Owner -> Name Repo -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +repoSecretsR user repo = + PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "secrets"] [] + +-- | Get a repository public key. +-- See +repoPublicKeyR :: Name Owner -> Name Organization -> GenRequest 'MtJSON 'RA PublicKey +repoPublicKeyR user org = + Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", "public-key"] [] + +-- | Get a repository secret. +-- See +repoSecretR :: Name Owner -> Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA RepoSecret +repoSecretR user org name = + Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] [] + +-- | Create or update a repository secret. +-- See +setRepoSecretR :: Name Owner -> Name Organization -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setRepoSecretR user org name = + command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode + +-- | Delete a repository secret. +-- See +deleteRepoSecretR :: Name Owner -> Name Organization -> Name Secret -> Request 'RW () +deleteRepoSecretR user org name = + command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] + +-- | List environment secrets. +-- See +environmentSecretsR :: Id Repo -> Name Environment -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +environmentSecretsR repo env = + PagedQuery ["repositories", toPathPart repo, "environments", toPathPart env, "secrets"] [] + +-- | Get an environment public key. +-- See +environmentPublicKeyR :: Id Repo -> Name Environment -> GenRequest 'MtJSON 'RA PublicKey +environmentPublicKeyR repo env = + Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", "public-key"] [] + +-- | Get an environment secret +-- See +environmentSecretR :: Id Repo -> Name Environment -> Name Secret -> GenRequest 'MtJSON 'RA RepoSecret +environmentSecretR repo env name = + Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] [] + +-- | Create or update an environment secret. +-- See +setEnvironmentSecretR :: Id Repo -> Name Environment -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setEnvironmentSecretR repo env name = + command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode + +-- | Delete an environment secret. +-- See +deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name Secret -> Request 'RW () +deleteEnvironmentSecretR repo env name = + command Delete parts mempty + where + parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] \ No newline at end of file From e74a8610277553afa5d87a6dd09b239a1a195e72 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Fri, 11 Nov 2022 16:37:18 -0800 Subject: [PATCH 07/34] Workflows. --- fixtures/actions/workflow-list.json | 17 +++ github.cabal | 2 + src/GitHub/Data.hs | 20 ++- src/GitHub/Data/Actions/Secrets.hs | 14 +-- src/GitHub/Data/Actions/Workflows.hs | 143 ++++++++++++++++++++++ src/GitHub/Endpoints/Actions/Secrets.hs | 28 ++--- src/GitHub/Endpoints/Actions/Workflows.hs | 87 +++++++++---- 7 files changed, 264 insertions(+), 47 deletions(-) create mode 100644 fixtures/actions/workflow-list.json create mode 100644 src/GitHub/Data/Actions/Workflows.hs diff --git a/fixtures/actions/workflow-list.json b/fixtures/actions/workflow-list.json new file mode 100644 index 00000000..d4abfadf --- /dev/null +++ b/fixtures/actions/workflow-list.json @@ -0,0 +1,17 @@ +{ + "total_count": 1, + "workflows": [ + { + "id": 39065091, + "node_id": "W_kwDOIVc8sc4CVBYD", + "name": "learn-github-actions", + "path": ".github/workflows/make_artifact.yaml", + "state": "active", + "created_at": "2022-10-29T15:17:59.000-07:00", + "updated_at": "2022-10-29T15:17:59.000-07:00", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "html_url": "https://github.com/kote-test-org-actions/actions-api/blob/main/.github/workflows/make_artifact.yaml", + "badge_url": "https://github.com/kote-test-org-actions/actions-api/workflows/learn-github-actions/badge.svg" + } + ] +} \ No newline at end of file diff --git a/github.cabal b/github.cabal index 886803db..8af22066 100644 --- a/github.cabal +++ b/github.cabal @@ -90,6 +90,7 @@ library GitHub.Data.Actions.Artifacts GitHub.Data.Actions.Cache GitHub.Data.Actions.Secrets + GitHub.Data.Actions.Workflows GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -124,6 +125,7 @@ library GitHub.Endpoints.Actions.Artifacts GitHub.Endpoints.Actions.Cache GitHub.Endpoints.Actions.Secrets + GitHub.Endpoints.Actions.Workflows GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 75d9664b..4421fbfd 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -19,7 +19,10 @@ module GitHub.Data ( mkCommitName, fromUserName, fromOrganizationName, - mkWorkflowRunId, + mkWorkflowName, + mkWorkflowId, + -- mkWorkflowRunId, + -- mkWorkflowRunName, -- ** Id Id, mkId, @@ -39,6 +42,7 @@ module GitHub.Data ( module GitHub.Data.Actions.Artifacts, module GitHub.Data.Actions.Cache, module GitHub.Data.Actions.Secrets, + module GitHub.Data.Actions.Workflows, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -76,6 +80,7 @@ import GitHub.Data.Actions.Common import GitHub.Data.Actions.Artifacts import GitHub.Data.Actions.Secrets import GitHub.Data.Actions.Cache +import GitHub.Data.Actions.Workflows import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content @@ -151,5 +156,14 @@ fromOrganizationId = Id . untagId fromUserId :: Id User -> Id Owner fromUserId = Id . untagId -mkWorkflowRunId :: Int -> Id WorkflowRun -mkWorkflowRunId = Id +mkWorkflowId :: Int -> Id Workflow +mkWorkflowId = Id + +mkWorkflowName :: Text -> Name Workflow +mkWorkflowName = N + +-- mkWorkflowRunId :: Int -> Id ActionWorkflowRun +-- mkWorkflowRunId = Id + +-- mkWorkflowRunName :: Text -> Name ActionWorkflowRun +-- mkWorkflowRunName = N diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index cc7cbdea..e710be4b 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -8,7 +8,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RecordWildCards #-} module GitHub.Data.Actions.Secrets ( - Secret(..), + OrganizationSecret(..), PublicKey(..), SetSecret(..), SelectedRepo(..), @@ -31,8 +31,8 @@ import Data.Maybe (maybeToList) -- Secret ------------------------------------------------------------------------------- -data Secret = Secret - { secretNmae :: !(Name Secret) +data OrganizationSecret = OrganizationSecret + { secretNmae :: !(Name OrganizationSecret) , secretCreatedAt :: !UTCTime , secretUpdatedAt :: !UTCTime , secretVisibility :: !Text @@ -65,7 +65,7 @@ data SetSelectedRepositories = SetSelectedRepositories deriving (Show, Data, Typeable, Eq, Ord, Generic) data RepoSecret = RepoSecret - { repoSecretNmae :: !(Name Secret) + { repoSecretNmae :: !(Name RepoSecret) , repoSecretCreatedAt :: !UTCTime , repoSecretUpdatedAt :: !UTCTime } @@ -79,14 +79,14 @@ data Environment = Environment -- -- JSON instances -- ------------------------------------------------------------------------------- -instance FromJSON Secret where - parseJSON = withObject "Secret" $ \o -> Secret +instance FromJSON OrganizationSecret where + parseJSON = withObject "Secret" $ \o -> OrganizationSecret <$> o .: "name" <*> o .: "created_at" <*> o .: "updated_at" <*> o .: "visibility" -instance FromJSON (WithTotalCount Secret) where +instance FromJSON (WithTotalCount OrganizationSecret) where parseJSON = withObject "SecretList" $ \o -> WithTotalCount <$> o .: "secrets" <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs new file mode 100644 index 00000000..9a8b1bbc --- /dev/null +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -0,0 +1,143 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RecordWildCards #-} + +module GitHub.Data.Actions.Workflows ( + Workflow(..), + -- ActionWorkflowResult(..), + -- ActionWorkflowRun(..), + -- Workflow, + -- ActionWorkflowRunResult(..), + CreateWorkflowDispatchEvent(..), + ) where + +import GitHub.Data.Definitions +import GitHub.Data.Id (Id) +import GitHub.Data.Options (IssueState (..), MergeableState (..)) +import GitHub.Data.Repos (Repo) +import GitHub.Data.URL (URL) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Internal.Prelude +import Prelude () + +import qualified Data.Text as T +import qualified Data.Vector as V + +data Workflow = Workflow + { + workflowWorkflowId :: !(Id Workflow) + , workflowName :: !Text + , workflowPath :: !Text + , workflowState :: !Text + , workflowCreatedAt :: !UTCTime + , workflowUpdatedAt :: !UTCTime + , workflowUrl :: !UTCTime + , workflowHtmlUrl :: !UTCTime + , workflowBadgeUrl :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data RunCommit = RunCommit +-- { +-- runCommitId :: !Text +-- , runCommitTreeId :: !Text +-- } +-- deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- instance NFData RunCommit where rnf = genericRnf +-- instance Binary RunCommit + + +-- data ActionWorkflowRun = ActionWorkflowRun +-- { +-- actionWorkflowRunId :: !(Id ActionWorkflowRun) +-- , actionWorkflowRunHeadBranch :: !Text +-- , actionWorkflowRunHeadSha :: !Text +-- , actionWorkflowRunStatus :: !Text +-- , actionWorkflowRunUrl :: !URL +-- , actionWorkflowRunHtmlUrl :: !URL +-- , actionWorkflowRunCreatedAt :: !UTCTime +-- , actionWorkflowRunUpdatedAt :: !UTCTime +-- -- , actionWorkflowRunRepo :: !Repo +-- , actionWorkflowRunHeadCommit :: !RunCommit +-- , actionWorkflowRunConclusion :: !(Maybe Text) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data ActionWorkflowResult entity = ActionWorkflowResult +-- { +-- actionWorkflowTotalCount :: !Int +-- , actionWorkflowResults :: !(Vector entity) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + + +-- data ActionWorkflowRunResult entity = ActionWorkflowRunResult +-- { +-- actionWorkflowRunResultTotalCount :: !Int +-- , actionWorkflowRunResultResults :: !(Vector entity) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data CreateWorkflowDispatchEvent a + = CreateWorkflowDispatchEvent + { createWorkflowDispatchEventRef :: !Text + , createWorkflowDispatchEventInputs :: !a + } + deriving (Show, Generic) + +instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf +instance (Binary a) => Binary (CreateWorkflowDispatchEvent a) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON Workflow where + parseJSON = withObject "Workflow" $ \o -> Workflow + <$> o .: "id" + <*> o .: "name" + <*> o .: "path" + <*> o .: "state" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "badge_url" + +instance FromJSON (WithTotalCount Workflow) where + parseJSON = withObject "WorkflowList" $ \o -> WithTotalCount + <$> o .: "workflows" + <*> o .: "total_count" + +-- instance FromJSON a => FromJSON (ActionWorkflowResult a) where +-- parseJSON = withObject "ActionWorkflowResult" $ \o -> ActionWorkflowResult +-- <$> o .: "total_count" +-- <*> o .:? "workflows" .!= V.empty + +-- instance FromJSON a => FromJSON (ActionWorkflowRunResult a) where +-- parseJSON = withObject "ActionWorkflowRunResult" $ \o -> ActionWorkflowRunResult +-- <$> o .: "total_count" +-- <*> o .:? "workflow_runs" .!= V.empty + +-- instance FromJSON RunCommit where +-- parseJSON = withObject "RunCommit" $ \o -> RunCommit +-- <$> o .: "id" +-- <*> o .: "tree_id" + +-- instance FromJSON ActionWorkflowRun where +-- parseJSON = withObject "ActionWorkflowRun" $ \o -> ActionWorkflowRun +-- <$> o .: "id" +-- <*> o .: "head_branch" +-- <*> o .: "head_sha" +-- <*> o .: "status" +-- <*> o .: "url" +-- <*> o .: "html_url" +-- <*> o .: "created_at" +-- <*> o .: "updated_at" +-- -- <*> o .: "repository" +-- <*> o .: "head_commit" +-- <*> o .:? "conclusion" + + +instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where + toJSON (CreateWorkflowDispatchEvent ref inputs) = + object [ "ref" .= ref, "inputs" .= inputs ] \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs index d2b8ff27..85b3b8ab 100644 --- a/src/GitHub/Endpoints/Actions/Secrets.hs +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -34,7 +34,7 @@ import Prelude () -- | List organization secrets. -- See -organizationSecretsR :: Name Organization -> GenRequest 'MtJSON 'RA (WithTotalCount Secret) +organizationSecretsR :: Name Organization -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) organizationSecretsR org = Query ["orgs", toPathPart org, "actions", "secrets"] [] @@ -46,19 +46,19 @@ organizationPublicKeyR org = -- | Get an organization secret. -- See -organizationSecretR :: Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA Secret +organizationSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtJSON 'RA OrganizationSecret organizationSecretR org name = Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name] [] -- | Create or update an organization secret. -- See -setOrganizationSecretR :: Name Organization -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> SetSecret -> GenRequest 'MtJSON 'RW () setOrganizationSecretR org name = command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete an organization secret. -- See -deleteOrganizationSecretR :: Name Organization -> Name Secret -> Request 'RW () +deleteOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> Request 'RW () deleteOrganizationSecretR org name = command Delete parts mempty where @@ -66,25 +66,25 @@ deleteOrganizationSecretR org name = -- | Get selected repositories for an organization secret. -- See -organizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) +organizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) organizationSelectedRepositoriesForSecretR org name = Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] -- | Set selected repositories for an organization secret. -- See -setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> SetSelectedRepositories -> GenRequest 'MtJSON 'RW () +setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> SetSelectedRepositories -> GenRequest 'MtJSON 'RW () setOrganizationSelectedRepositoriesForSecretR org name = command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode -- | Add selected repository to an organization secret. -- See -addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> Id Repo -> GenRequest 'MtJSON 'RW () +addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtJSON 'RW () addOrganizationSelectedRepositoriesForSecretR org name repo = command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty -- | Remove selected repository from an organization secret. -- See -removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name Secret -> Id Repo -> GenRequest 'MtJSON 'RW () +removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtJSON 'RW () removeOrganizationSelectedRepositoriesForSecretR org name repo = command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty @@ -102,19 +102,19 @@ repoPublicKeyR user org = -- | Get a repository secret. -- See -repoSecretR :: Name Owner -> Name Organization -> Name Secret -> GenRequest 'MtJSON 'RA RepoSecret +repoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> GenRequest 'MtJSON 'RA RepoSecret repoSecretR user org name = Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] [] -- | Create or update a repository secret. -- See -setRepoSecretR :: Name Owner -> Name Organization -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> SetSecret -> GenRequest 'MtJSON 'RW () setRepoSecretR user org name = command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete a repository secret. -- See -deleteRepoSecretR :: Name Owner -> Name Organization -> Name Secret -> Request 'RW () +deleteRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> Request 'RW () deleteRepoSecretR user org name = command Delete parts mempty where @@ -134,19 +134,19 @@ environmentPublicKeyR repo env = -- | Get an environment secret -- See -environmentSecretR :: Id Repo -> Name Environment -> Name Secret -> GenRequest 'MtJSON 'RA RepoSecret +environmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> GenRequest 'MtJSON 'RA RepoSecret environmentSecretR repo env name = Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] [] -- | Create or update an environment secret. -- See -setEnvironmentSecretR :: Id Repo -> Name Environment -> Name Secret -> SetSecret -> GenRequest 'MtJSON 'RW () +setEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> SetSecret -> GenRequest 'MtJSON 'RW () setEnvironmentSecretR repo env name = command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode -- | Delete an environment secret. -- See -deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name Secret -> Request 'RW () +deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> Request 'RW () deleteEnvironmentSecretR repo env name = command Delete parts mempty where diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 677c2760..83ac1a5d 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -5,33 +5,74 @@ -- -- -- -- The pull requests API as documented at -- -- . --- module GitHub.Endpoints.Actions.Workflows ( --- workflowsForR, --- workflowRunsForR, --- createWorkflowDispatchEventR, --- workflowRunForR, --- module GitHub.Data --- ) where +module GitHub.Endpoints.Actions.Workflows ( + repositoryWorkflowsR, + workflowR, + disableWorkflowR, + triggerWorkflowR, + enableWorkflowR, + module GitHub.Data + ) where --- import GitHub.Data --- import GitHub.Internal.Prelude --- import Prelude () --- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () --- -- | List pull requests. --- -- See --- workflowsForR --- :: Name Owner --- -> Name Repo --- -- -> FetchCount --- -> Request k (ActionWorkflowResult ActionWorkflow) --- workflowsForR user repo = query --- ["repos", toPathPart user, toPathPart repo, "actions", "workflows"] --- [] +-- | List repository workflows. +-- See +repositoryWorkflowsR + :: Name Owner + -> Name Repo + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Workflow) +repositoryWorkflowsR user repo = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "workflows"] + [] + +-- | Get a workflow. +-- See +workflowR + :: Name Owner + -> Name Repo + -> Id Workflow + -> GenRequest 'MtJSON 'RA Workflow +workflowR user repo workflow = Query + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow] + [] + +-- | Disable a workflow. +-- See +disableWorkflowR + :: Name Owner + -> Name Repo + -> Id Workflow + -> GenRequest 'MtJSON 'RW Workflow +disableWorkflowR user repo workflow = command Put + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "disable"] + mempty --- -- TODO move? --- -- data Workflow +-- | Create a workflow dispatch event. +-- See +triggerWorkflowR + :: (ToJSON a) => Name Owner + -> Name Repo + -> Id Workflow + -> CreateWorkflowDispatchEvent a + -> GenRequest 'MtJSON 'RW Workflow +triggerWorkflowR user repo workflow = command Post + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "dispatches"] + . encode +-- | Enable a workflow. +-- See +enableWorkflowR + :: Name Owner + -> Name Repo + -> Id Workflow + -> GenRequest 'MtJSON 'RW Workflow +enableWorkflowR user repo workflow = command Put + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "enable"] + mempty -- workflowRunsForR -- :: Name Owner From 63520036cb3b4b72003162197cdcc1bcf7d9da00 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Fri, 11 Nov 2022 21:09:32 -0800 Subject: [PATCH 08/34] WorkflowJobs. --- fixtures/actions/workflow-job.json | 113 +++++++++++ github.cabal | 3 + src/GitHub/Data.hs | 4 + src/GitHub/Data/Actions/Artifacts.hs | 33 ++-- src/GitHub/Data/Actions/Secrets.hs | 8 +- src/GitHub/Data/Actions/WorkflowJobs.hs | 110 +++++++++++ src/GitHub/Data/Actions/WorkflowRuns.hs | 188 +++++++++++++++++++ src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 43 +++++ 8 files changed, 482 insertions(+), 20 deletions(-) create mode 100644 fixtures/actions/workflow-job.json create mode 100644 src/GitHub/Data/Actions/WorkflowJobs.hs create mode 100644 src/GitHub/Data/Actions/WorkflowRuns.hs create mode 100644 src/GitHub/Endpoints/Actions/WorkflowJobs.hs diff --git a/fixtures/actions/workflow-job.json b/fixtures/actions/workflow-job.json new file mode 100644 index 00000000..f9548006 --- /dev/null +++ b/fixtures/actions/workflow-job.json @@ -0,0 +1,113 @@ +{ + "id": 9183275828, + "run_id": 3353449941, + "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "run_attempt": 1, + "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", + "status": "completed", + "conclusion": "success", + "started_at": "2022-10-30T00:09:29Z", + "completed_at": "2022-10-30T00:09:49Z", + "name": "check-bats-version", + "steps": [ + { + "name": "Set up job", + "status": "completed", + "conclusion": "success", + "number": 1, + "started_at": "2022-10-29T17:09:29.000-07:00", + "completed_at": "2022-10-29T17:09:32.000-07:00" + }, + { + "name": "Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 2, + "started_at": "2022-10-29T17:09:32.000-07:00", + "completed_at": "2022-10-29T17:09:33.000-07:00" + }, + { + "name": "Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 3, + "started_at": "2022-10-29T17:09:34.000-07:00", + "completed_at": "2022-10-29T17:09:39.000-07:00" + }, + { + "name": "Run npm install -g bats", + "status": "completed", + "conclusion": "success", + "number": 4, + "started_at": "2022-10-29T17:09:40.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Run bats -v", + "status": "completed", + "conclusion": "success", + "number": 5, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Archive Test", + "status": "completed", + "conclusion": "success", + "number": 6, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:46.000-07:00" + }, + { + "name": "Cache", + "status": "completed", + "conclusion": "success", + "number": 7, + "started_at": "2022-10-29T17:09:46.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Cache", + "status": "completed", + "conclusion": "success", + "number": 12, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 13, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Post Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 14, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Complete job", + "status": "completed", + "conclusion": "success", + "number": 15, + "started_at": "2022-10-29T17:09:47.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + } + ], + "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", + "labels": [ + "ubuntu-latest" + ], + "runner_id": 1, + "runner_name": "Hosted Agent", + "runner_group_id": 2, + "runner_group_name": "GitHub Actions" + } \ No newline at end of file diff --git a/github.cabal b/github.cabal index 8af22066..fdc78f47 100644 --- a/github.cabal +++ b/github.cabal @@ -91,6 +91,8 @@ library GitHub.Data.Actions.Cache GitHub.Data.Actions.Secrets GitHub.Data.Actions.Workflows + GitHub.Data.Actions.WorkflowJobs + GitHub.Data.Actions.WorkflowRuns GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -126,6 +128,7 @@ library GitHub.Endpoints.Actions.Cache GitHub.Endpoints.Actions.Secrets GitHub.Endpoints.Actions.Workflows + GitHub.Endpoints.Actions.WorkflowJobs GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 4421fbfd..e56b089a 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -43,6 +43,8 @@ module GitHub.Data ( module GitHub.Data.Actions.Cache, module GitHub.Data.Actions.Secrets, module GitHub.Data.Actions.Workflows, + module GitHub.Data.Actions.WorkflowJobs, + module GitHub.Data.Actions.WorkflowRuns, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -81,6 +83,8 @@ import GitHub.Data.Actions.Artifacts import GitHub.Data.Actions.Secrets import GitHub.Data.Actions.Cache import GitHub.Data.Actions.Workflows +import GitHub.Data.Actions.WorkflowJobs +import GitHub.Data.Actions.WorkflowRuns import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index d11f64b3..63579856 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -8,7 +8,7 @@ {-# LANGUAGE KindSignatures #-} module GitHub.Data.Actions.Artifacts ( Artifact(..), - WorkflowRun(..), + -- WorkflowRun(..), ) where import GitHub.Data.Id (Id) @@ -18,19 +18,20 @@ import Prelude () import GitHub.Data.Repos (Repo) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) ------------------------------------------------------------------------------- -- Artifact ------------------------------------------------------------------------------- -data WorkflowRun = WorkflowRun - { workflowRunWorkflowRunId :: !(Id WorkflowRun) - , workflowRunRepositoryId :: !(Id Repo) - , workflowRunHeadRepositoryId :: !(Id Repo) - , workflowRunHeadBranch :: !Text - , workflowRunHeadSha :: !Text - } - deriving (Show, Data, Typeable, Eq, Ord, Generic) +-- data WorkflowRun = WorkflowRun +-- { workflowRunWorkflowRunId :: !(Id WorkflowRun) +-- , workflowRunRepositoryId :: !(Id Repo) +-- , workflowRunHeadRepositoryId :: !(Id Repo) +-- , workflowRunHeadBranch :: !Text +-- , workflowRunHeadSha :: !Text +-- } +-- deriving (Show, Data, Typeable, Eq, Ord, Generic) data Artifact = Artifact { artifactArchiveDownloadUrl :: !URL @@ -51,13 +52,13 @@ data Artifact = Artifact -- JSON instances ------------------------------------------------------------------------------- -instance FromJSON WorkflowRun where - parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun - <$> o .: "id" - <*> o .: "repository_id" - <*> o .: "head_repository_id" - <*> o .: "head_branch" - <*> o .: "head_sha" +-- instance FromJSON WorkflowRun where +-- parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun +-- <$> o .: "id" +-- <*> o .: "repository_id" +-- <*> o .: "head_repository_id" +-- <*> o .: "head_branch" +-- <*> o .: "head_sha" instance FromJSON Artifact where parseJSON = withObject "Artifact" $ \o -> Artifact diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index e710be4b..2373db56 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -32,10 +32,10 @@ import Data.Maybe (maybeToList) ------------------------------------------------------------------------------- data OrganizationSecret = OrganizationSecret - { secretNmae :: !(Name OrganizationSecret) - , secretCreatedAt :: !UTCTime - , secretUpdatedAt :: !UTCTime - , secretVisibility :: !Text + { organizationSecretNmae :: !(Name OrganizationSecret) + , organizationSecretCreatedAt :: !UTCTime + , organizationSecretUpdatedAt :: !UTCTime + , organizationSecretVisibility :: !Text } deriving (Show, Data, Typeable, Eq, Ord, Generic) diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs new file mode 100644 index 00000000..7e52ded7 --- /dev/null +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -0,0 +1,110 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.WorkflowJobs ( + JobStep(..), + Job(..), + ) where + +import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) +import GitHub.Data.Name (Name) +import GitHub.Internal.Prelude + ( ($), + Eq, + Data, + Ord, + Show, + Typeable, + Applicative((<*>)), + Generic, + Integer, + (<$>), + (.:), + withObject, + FromJSON(parseJSON), + Text, + UTCTime, + Vector ) +import Prelude () + +import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) + + +data JobStep = JobStep + { + jobStepName :: !(Name JobStep) + , jobStepStatus :: !Text + , jobStepConclusion :: !Text + , jobStepNumber :: !Integer + , jobStepStartedAt :: !UTCTime + , jobStepCompletedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data Job = Job + { + jobId :: !(Id Job) + , jobRunId :: !(Id WorkflowRun) + , jobRunUrl :: !URL + , jobRunAttempt :: !Integer + , jobNodeId :: !Text + , jobHeadSha :: !Text + , jobUrl :: !URL + , jobHtmlUrl :: !URL + , jobStatus :: !Text + , jobConclusion :: !Text + , jobStartedAt :: !UTCTime + , jobCompletedAt :: !UTCTime + , jobSteps :: !(Vector JobStep) + , jobRunCheckUrl :: !URL + , jobLabels :: !(Vector Text) + , jobRunnerId :: !Integer + , jobRunnerName :: !Text + , jobRunnerGroupId :: !Integer + , jobRunnerGroupName :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON JobStep where + parseJSON = withObject "JobStep" $ \o -> JobStep + <$> o .: "name" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "number" + <*> o .: "started_at" + <*> o .: "completed_at" + +instance FromJSON Job where + parseJSON = withObject "Job" $ \o -> Job + <$> o .: "id" + <*> o .: "run_id" + <*> o .: "run_url" + <*> o .: "run_attempt" + <*> o .: "node_id" + <*> o .: "head_sha" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "started_at" + <*> o .: "completed_at" + <*> o .: "steps" + <*> o .: "check_run_url" + <*> o .: "labels" + <*> o .: "runner_id" + <*> o .: "runner_name" + <*> o .: "runner_group_id" + <*> o .: "runner_group_name" + +instance FromJSON (WithTotalCount Job) where + parseJSON = withObject "JobList" $ \o -> WithTotalCount + <$> o .: "jobs" + <*> o .: "total_count" \ No newline at end of file diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs new file mode 100644 index 00000000..cc2b3587 --- /dev/null +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -0,0 +1,188 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RecordWildCards #-} + +module GitHub.Data.Actions.WorkflowRuns ( + -- Workflow(..), + -- ActionWorkflowResult(..), + -- ActionWorkflowRun(..), + -- Workflow, + -- ActionWorkflowRunResult(..), + WorkflowRun(..), + RunAttempt(..), + ) where + +import GitHub.Data.Definitions +import GitHub.Data.Id (Id) +import GitHub.Data.Options (IssueState (..), MergeableState (..)) +import GitHub.Data.Repos (Repo) +import GitHub.Data.URL (URL) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Internal.Prelude +import Prelude () + +import qualified Data.Text as T +import qualified Data.Vector as V + -- "run_id": 3353449941, + -- "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + -- "run_attempt": 1, + -- "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", + -- "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + -- "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", + -- "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", + -- "status": "completed", + -- "conclusion": "success", + -- "started_at": "2022-10-30T00:09:29Z", + -- "completed_at": "2022-10-30T00:09:49Z", + -- -- "name": "check-bats-version", + -- { + -- "name": "Set up job", + -- "status": "completed", + -- "conclusion": "success", + -- "number": 1, + -- "started_at": "2022-10-29T17:09:29.000-07:00", + -- "completed_at": "2022-10-29T17:09:32.000-07:00" + -- }, + -- "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", + -- "labels": [ + -- "ubuntu-latest" + -- ], + -- "runner_id": 1, + -- "runner_name": "Hosted Agent", + -- "runner_group_id": 2, + -- "runner_group_name": "GitHub Actions" +data WorkflowRun = WorkflowRun + { workflowRunWorkflowRunId :: !(Id WorkflowRun) + , workflowRunRepositoryId :: !(Id Repo) + , workflowRunHeadRepositoryId :: !(Id Repo) + , workflowRunHeadBranch :: !Text + , workflowRunHeadSha :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RunAttempt = RunAttempt + -- { + -- jobId :: !(Id Job) + -- , runRunId :: !(Id WorkflowRun) + -- , workflowPath :: !Text + -- , workflowState :: !Text + -- , workflowCreatedAt :: !UTCTime + -- , workflowUpdatedAt :: !UTCTime + -- , workflowUrl :: !UTCTime + -- , workflowHtmlUrl :: !UTCTime + -- , workflowBadgeUrl :: !UTCTime + -- } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data RunCommit = RunCommit +-- { +-- runCommitId :: !Text +-- , runCommitTreeId :: !Text +-- } +-- deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- instance NFData RunCommit where rnf = genericRnf +-- instance Binary RunCommit + + +-- data ActionWorkflowRun = ActionWorkflowRun +-- { +-- actionWorkflowRunId :: !(Id ActionWorkflowRun) +-- , actionWorkflowRunHeadBranch :: !Text +-- , actionWorkflowRunHeadSha :: !Text +-- , actionWorkflowRunStatus :: !Text +-- , actionWorkflowRunUrl :: !URL +-- , actionWorkflowRunHtmlUrl :: !URL +-- , actionWorkflowRunCreatedAt :: !UTCTime +-- , actionWorkflowRunUpdatedAt :: !UTCTime +-- -- , actionWorkflowRunRepo :: !Repo +-- , actionWorkflowRunHeadCommit :: !RunCommit +-- , actionWorkflowRunConclusion :: !(Maybe Text) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data ActionWorkflowResult entity = ActionWorkflowResult +-- { +-- actionWorkflowTotalCount :: !Int +-- , actionWorkflowResults :: !(Vector entity) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + + +-- data ActionWorkflowRunResult entity = ActionWorkflowRunResult +-- { +-- actionWorkflowRunResultTotalCount :: !Int +-- , actionWorkflowRunResultResults :: !(Vector entity) +-- } deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- data CreateWorkflowDispatchEvent a +-- = CreateWorkflowDispatchEvent +-- { createWorkflowDispatchEventRef :: !Text +-- , createWorkflowDispatchEventInputs :: !a +-- } +-- deriving (Show, Generic) + +-- instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf +-- instance (Binary a) => Binary (CreateWorkflowDispatchEvent a) + +-- ------------------------------------------------------------------------------- +-- -- JSON instances +-- ------------------------------------------------------------------------------- + +-- instance FromJSON Workflow where +-- parseJSON = withObject "Workflow" $ \o -> Workflow +-- <$> o .: "id" +-- <*> o .: "name" +-- <*> o .: "path" +-- <*> o .: "state" +-- <*> o .: "created_at" +-- <*> o .: "updated_at" +-- <*> o .: "url" +-- <*> o .: "html_url" +-- <*> o .: "badge_url" + +-- instance FromJSON (WithTotalCount Workflow) where +-- parseJSON = withObject "WorkflowList" $ \o -> WithTotalCount +-- <$> o .: "workflows" +-- <*> o .: "total_count" + +-- -- instance FromJSON a => FromJSON (ActionWorkflowResult a) where +-- -- parseJSON = withObject "ActionWorkflowResult" $ \o -> ActionWorkflowResult +-- -- <$> o .: "total_count" +-- -- <*> o .:? "workflows" .!= V.empty + +-- -- instance FromJSON a => FromJSON (ActionWorkflowRunResult a) where +-- -- parseJSON = withObject "ActionWorkflowRunResult" $ \o -> ActionWorkflowRunResult +-- -- <$> o .: "total_count" +-- -- <*> o .:? "workflow_runs" .!= V.empty + +-- -- instance FromJSON RunCommit where +-- -- parseJSON = withObject "RunCommit" $ \o -> RunCommit +-- -- <$> o .: "id" +-- -- <*> o .: "tree_id" + +-- -- instance FromJSON ActionWorkflowRun where +-- -- parseJSON = withObject "ActionWorkflowRun" $ \o -> ActionWorkflowRun +-- -- <$> o .: "id" +-- -- <*> o .: "head_branch" +-- -- <*> o .: "head_sha" +-- -- <*> o .: "status" +-- -- <*> o .: "url" +-- -- <*> o .: "html_url" +-- -- <*> o .: "created_at" +-- -- <*> o .: "updated_at" +-- -- -- <*> o .: "repository" +-- -- <*> o .: "head_commit" +-- -- <*> o .:? "conclusion" + + +-- instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where +-- toJSON (CreateWorkflowDispatchEvent ref inputs) = +-- object [ "ref" .= ref, "inputs" .= inputs ] + +instance FromJSON WorkflowRun where + parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun + <$> o .: "id" + <*> o .: "repository_id" + <*> o .: "head_repository_id" + <*> o .: "head_branch" + <*> o .: "head_sha" \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs new file mode 100644 index 00000000..643b1331 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -0,0 +1,43 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The actions API as documented at +-- . +module GitHub.Endpoints.Actions.WorkflowJobs ( + jobR, + downloadJobLogsR, + jobsForWorkflowRunAttemptR, + jobsForWorkflowRunR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () +import Network.URI (URI) + +-- | Get a job for a workflow run. +-- See +jobR :: Name Owner -> Name Repo -> Id Job -> Request 'RO Job +jobR owner repo job = + Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job] [] + +-- | Download job logs for a workflow run. +-- See +downloadJobLogsR :: Name Owner -> Name Repo -> Id Job -> GenRequest 'MtRedirect 'RO URI +downloadJobLogsR owner repo job = + Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job, "logs"] [] + +-- | List jobs for a workflow run attempt. +-- See +jobsForWorkflowRunAttemptR :: Name Owner -> Name Repo -> Id WorkflowRun -> Id RunAttempt -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunAttemptR owner repo run attempt = + PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "jobs"] [] + +-- | List jobs for a workflow run. +-- See +jobsForWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunR owner repo run = + PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] [] \ No newline at end of file From 2811abb63271b3428de8e845a5a7295e87814d39 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sat, 12 Nov 2022 17:05:36 -0800 Subject: [PATCH 09/34] WorkflowRuns. --- fixtures/actions/workflow-runs-list.json | 678 +++++++++++++++++++ github.cabal | 1 + src/GitHub/Data/Actions/Artifacts.hs | 34 +- src/GitHub/Data/Actions/WorkflowRuns.hs | 82 ++- src/GitHub/Data/Actions/Workflows.hs | 80 --- src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 181 +++++ src/GitHub/Endpoints/Actions/Workflows.hs | 32 +- 7 files changed, 927 insertions(+), 161 deletions(-) create mode 100644 fixtures/actions/workflow-runs-list.json create mode 100644 src/GitHub/Endpoints/Actions/WorkflowRuns.hs diff --git a/fixtures/actions/workflow-runs-list.json b/fixtures/actions/workflow-runs-list.json new file mode 100644 index 00000000..28f51b33 --- /dev/null +++ b/fixtures/actions/workflow-runs-list.json @@ -0,0 +1,678 @@ +{ + "total_count": 3, + "workflow_runs": [ + { + "id": 3353449941, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4ZXV", + "head_branch": "main", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 3, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030268154, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj70-g", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941", + "pull_requests": [ + + ], + "created_at": "2022-10-30T00:09:22Z", + "updated_at": "2022-10-30T00:09:50Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [ + + ], + "run_started_at": "2022-10-30T00:09:22Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030268154", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "3156f684232a3adec5085c920d2006aca80f2798", + "tree_id": "f51ba8632086ca7af92f5e58c1dc98df1c62d7ce", + "message": "up", + "timestamp": "2022-10-30T00:09:16Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353445625, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4YT5", + "head_branch": "main", + "head_sha": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 2, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030259685, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj7T5Q", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353445625", + "pull_requests": [ + + ], + "created_at": "2022-10-30T00:07:49Z", + "updated_at": "2022-10-30T00:08:19Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [ + + ], + "run_started_at": "2022-10-30T00:07:49Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030259685", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "tree_id": "21d858674ab650ea734b7efbf05442a21685d121", + "message": "up", + "timestamp": "2022-10-30T00:07:44Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353148947, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H3P4T", + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 1, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9029740591, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGjboLw", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353148947", + "pull_requests": [ + + ], + "created_at": "2022-10-29T22:18:02Z", + "updated_at": "2022-10-29T22:18:22Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [ + + ], + "run_started_at": "2022-10-29T22:18:02Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9029740591", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "tree_id": "7aa2d4e6f4e0ddb277fe2f35f7615651ee01c5a2", + "message": "test", + "timestamp": "2022-10-29T22:17:55Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + } + ] + } + \ No newline at end of file diff --git a/github.cabal b/github.cabal index 22763493..c6cc8328 100644 --- a/github.cabal +++ b/github.cabal @@ -130,6 +130,7 @@ library GitHub.Endpoints.Actions.Secrets GitHub.Endpoints.Actions.Workflows GitHub.Endpoints.Actions.WorkflowJobs + GitHub.Endpoints.Actions.WorkflowRuns GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index 63579856..55c31e34 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -8,7 +8,7 @@ {-# LANGUAGE KindSignatures #-} module GitHub.Data.Actions.Artifacts ( Artifact(..), - -- WorkflowRun(..), + ArtifactWorkflowRun(..), ) where import GitHub.Data.Id (Id) @@ -24,14 +24,14 @@ import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) ------------------------------------------------------------------------------- -- Artifact ------------------------------------------------------------------------------- --- data WorkflowRun = WorkflowRun --- { workflowRunWorkflowRunId :: !(Id WorkflowRun) --- , workflowRunRepositoryId :: !(Id Repo) --- , workflowRunHeadRepositoryId :: !(Id Repo) --- , workflowRunHeadBranch :: !Text --- , workflowRunHeadSha :: !Text --- } --- deriving (Show, Data, Typeable, Eq, Ord, Generic) +data ArtifactWorkflowRun = ArtifactWorkflowRun + { artifactWorkflowRunWorkflowRunId :: !(Id WorkflowRun) + , artifactWorkflowRunRepositoryId :: !(Id Repo) + , artifactWorkflowRunHeadRepositoryId :: !(Id Repo) + , artifactWorkflowRunHeadBranch :: !Text + , artifactWorkflowRunHeadSha :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) data Artifact = Artifact { artifactArchiveDownloadUrl :: !URL @@ -44,7 +44,7 @@ data Artifact = Artifact , artifactSizeInBytes :: !Int , artifactUpdatedAt :: !UTCTime , artifactUrl :: !URL - , workflowRun :: !WorkflowRun + , workflowRun :: !ArtifactWorkflowRun } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -52,13 +52,13 @@ data Artifact = Artifact -- JSON instances ------------------------------------------------------------------------------- --- instance FromJSON WorkflowRun where --- parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun --- <$> o .: "id" --- <*> o .: "repository_id" --- <*> o .: "head_repository_id" --- <*> o .: "head_branch" --- <*> o .: "head_sha" +instance FromJSON ArtifactWorkflowRun where + parseJSON = withObject "ArtifactWorkflowRun" $ \o -> ArtifactWorkflowRun + <$> o .: "id" + <*> o .: "repository_id" + <*> o .: "head_repository_id" + <*> o .: "head_branch" + <*> o .: "head_sha" instance FromJSON Artifact where parseJSON = withObject "Artifact" $ \o -> Artifact diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index cc2b3587..4abd4d48 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -11,6 +11,7 @@ module GitHub.Data.Actions.WorkflowRuns ( -- ActionWorkflowRunResult(..), WorkflowRun(..), RunAttempt(..), + ReviewHistory(..), ) where import GitHub.Data.Definitions @@ -24,40 +25,32 @@ import Prelude () import qualified Data.Text as T import qualified Data.Vector as V - -- "run_id": 3353449941, - -- "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", - -- "run_attempt": 1, - -- "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", - -- "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", - -- "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", - -- "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", - -- "status": "completed", - -- "conclusion": "success", - -- "started_at": "2022-10-30T00:09:29Z", - -- "completed_at": "2022-10-30T00:09:49Z", - -- -- "name": "check-bats-version", - -- { - -- "name": "Set up job", - -- "status": "completed", - -- "conclusion": "success", - -- "number": 1, - -- "started_at": "2022-10-29T17:09:29.000-07:00", - -- "completed_at": "2022-10-29T17:09:32.000-07:00" - -- }, - -- "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", - -- "labels": [ - -- "ubuntu-latest" - -- ], - -- "runner_id": 1, - -- "runner_name": "Hosted Agent", - -- "runner_group_id": 2, - -- "runner_group_name": "GitHub Actions" +import GitHub.Data.PullRequests (SimplePullRequest) + +import GitHub.Data.Name (Name) + data WorkflowRun = WorkflowRun { workflowRunWorkflowRunId :: !(Id WorkflowRun) - , workflowRunRepositoryId :: !(Id Repo) - , workflowRunHeadRepositoryId :: !(Id Repo) + , workflowRunName :: !(Name WorkflowRun) , workflowRunHeadBranch :: !Text , workflowRunHeadSha :: !Text + , workflowRunPath :: !Text + , workflowRunDisplayTitle :: !Text + , workflowRunRunNumber :: !Integer + , workflowRunEvent :: !Text + , workflowRunStatus :: !Text + , workflowRunConclusion :: !Text + , workflowRunWorkflowId :: !Integer + , workflowRunUrl :: !URL + , workflowRunHtmlUrl :: !URL + , workflowRunPullRequests :: !(Vector SimplePullRequest) + , workflowRunCreatedAt :: !UTCTime + , workflowRunUpdatedAt :: !UTCTime + , workflowRunActor :: !SimpleUser + , workflowRunAttempt :: !Integer + , workflowRunStartedAt :: !UTCTime + , workflowRunTrigerringActor :: !SimpleUser + , workflowRunRepository :: !Repo } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -75,6 +68,13 @@ data RunAttempt = RunAttempt -- } deriving (Show, Data, Typeable, Eq, Ord, Generic) +data ReviewHistory = ReviewHistory + { reviewHistoryState :: !Text + , reviewHistoryComment :: !Text + , reviewHistoryUser :: !SimpleUser + + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) -- data RunCommit = RunCommit -- { -- runCommitId :: !Text @@ -182,7 +182,23 @@ data RunAttempt = RunAttempt instance FromJSON WorkflowRun where parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun <$> o .: "id" - <*> o .: "repository_id" - <*> o .: "head_repository_id" + <*> o .: "name" <*> o .: "head_branch" - <*> o .: "head_sha" \ No newline at end of file + <*> o .: "head_sha" + <*> o .: "path" + <*> o .: "display_title" + <*> o .: "run_number" + <*> o .: "event" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "workflow_id" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "pull_requests" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "actor" + <*> o .: "attempt" + <*> o .: "started_at" + <*> o .: "trigerring_actor" + <*> o .: "repository" \ No newline at end of file diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index 9a8b1bbc..920fe65c 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -1,28 +1,17 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} -{-# LANGUAGE RecordWildCards #-} module GitHub.Data.Actions.Workflows ( Workflow(..), - -- ActionWorkflowResult(..), - -- ActionWorkflowRun(..), - -- Workflow, - -- ActionWorkflowRunResult(..), CreateWorkflowDispatchEvent(..), ) where -import GitHub.Data.Definitions import GitHub.Data.Id (Id) -import GitHub.Data.Options (IssueState (..), MergeableState (..)) -import GitHub.Data.Repos (Repo) -import GitHub.Data.URL (URL) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Internal.Prelude import Prelude () -import qualified Data.Text as T -import qualified Data.Vector as V data Workflow = Workflow { @@ -38,45 +27,6 @@ data Workflow = Workflow } deriving (Show, Data, Typeable, Eq, Ord, Generic) --- data RunCommit = RunCommit --- { --- runCommitId :: !Text --- , runCommitTreeId :: !Text --- } --- deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- instance NFData RunCommit where rnf = genericRnf --- instance Binary RunCommit - - --- data ActionWorkflowRun = ActionWorkflowRun --- { --- actionWorkflowRunId :: !(Id ActionWorkflowRun) --- , actionWorkflowRunHeadBranch :: !Text --- , actionWorkflowRunHeadSha :: !Text --- , actionWorkflowRunStatus :: !Text --- , actionWorkflowRunUrl :: !URL --- , actionWorkflowRunHtmlUrl :: !URL --- , actionWorkflowRunCreatedAt :: !UTCTime --- , actionWorkflowRunUpdatedAt :: !UTCTime --- -- , actionWorkflowRunRepo :: !Repo --- , actionWorkflowRunHeadCommit :: !RunCommit --- , actionWorkflowRunConclusion :: !(Maybe Text) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- data ActionWorkflowResult entity = ActionWorkflowResult --- { --- actionWorkflowTotalCount :: !Int --- , actionWorkflowResults :: !(Vector entity) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - - --- data ActionWorkflowRunResult entity = ActionWorkflowRunResult --- { --- actionWorkflowRunResultTotalCount :: !Int --- , actionWorkflowRunResultResults :: !(Vector entity) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent { createWorkflowDispatchEventRef :: !Text @@ -108,36 +58,6 @@ instance FromJSON (WithTotalCount Workflow) where <$> o .: "workflows" <*> o .: "total_count" --- instance FromJSON a => FromJSON (ActionWorkflowResult a) where --- parseJSON = withObject "ActionWorkflowResult" $ \o -> ActionWorkflowResult --- <$> o .: "total_count" --- <*> o .:? "workflows" .!= V.empty - --- instance FromJSON a => FromJSON (ActionWorkflowRunResult a) where --- parseJSON = withObject "ActionWorkflowRunResult" $ \o -> ActionWorkflowRunResult --- <$> o .: "total_count" --- <*> o .:? "workflow_runs" .!= V.empty - --- instance FromJSON RunCommit where --- parseJSON = withObject "RunCommit" $ \o -> RunCommit --- <$> o .: "id" --- <*> o .: "tree_id" - --- instance FromJSON ActionWorkflowRun where --- parseJSON = withObject "ActionWorkflowRun" $ \o -> ActionWorkflowRun --- <$> o .: "id" --- <*> o .: "head_branch" --- <*> o .: "head_sha" --- <*> o .: "status" --- <*> o .: "url" --- <*> o .: "html_url" --- <*> o .: "created_at" --- <*> o .: "updated_at" --- -- <*> o .: "repository" --- <*> o .: "head_commit" --- <*> o .:? "conclusion" - - instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where toJSON (CreateWorkflowDispatchEvent ref inputs) = object [ "ref" .= ref, "inputs" .= inputs ] \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs new file mode 100644 index 00000000..7351d682 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -0,0 +1,181 @@ +-- ----------------------------------------------------------------------------- +-- -- | +-- -- License : BSD-3-Clause +-- -- Maintainer : Oleg Grenrus +-- -- +-- -- The pull requests API as documented at +-- -- . +module GitHub.Endpoints.Actions.WorkflowRuns ( + reRunJobR, + workflowRunsR, + workflowRunR, + deleteWorkflowRunR, + workflowRunReviewHistoryR, + approveWorkflowRunR, + workflowRunAttemptR, + downloadWorkflowRunAttemptLogsR, + cancelWorkflowRunR, + downloadWorkflowRunLogsR, + deleteWorkflowRunLogsR, + reRunWorkflowR, + reRunFailedJobsR, + workflowRunsForWorkflowR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () +import Network.URI (URI) + +-- | Re-run a job from a workflow run. +-- See +reRunJobR + :: Name Owner + -> Name Repo + -> Id Job -> GenRequest 'MtJSON 'RW () +reRunJobR user repo job = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"] + mempty + +-- | List workflow runs for a repository. +-- See +workflowRunsR + :: Name Owner + -> Name Repo + -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunsR user repo = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "runs"] + [] + +-- | Get a workflow run. +-- See +workflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] + [] + +-- | Delete a workflow run. +-- See +deleteWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RW () +deleteWorkflowRunR user repo run = Command Delete + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] + mempty + +-- | Get the review history for a workflow run. +-- See +workflowRunReviewHistoryR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RA (Vector ReviewHistory) +workflowRunReviewHistoryR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approvals"] + [] + +-- | Approve a workflow run for a fork pull request. +-- See +approveWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RW () +approveWorkflowRunR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approve"] + mempty + +-- | Get a workflow run attempt. +-- See +workflowRunAttemptR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunAttemptR user repo run attempt = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt] + [] + +-- | Download workflow run attempt logs. +-- See +downloadWorkflowRunAttemptLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> GenRequest 'MtRedirect 'RO URI +downloadWorkflowRunAttemptLogsR user repo run attempt = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "logs"] + [] + +-- | Cancel a workflow run. +-- See +cancelWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RW () +cancelWorkflowRunR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "cancel"] + mempty + +-- | Download workflow run logs. +-- See +downloadWorkflowRunLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtRedirect 'RO URI +downloadWorkflowRunLogsR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] + [] + +-- | Delete workflow run logs. +-- See +deleteWorkflowRunLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RW () +deleteWorkflowRunLogsR user repo run = Command Delete + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] + mempty + +-- | Re-run a workflow. +-- See +reRunWorkflowR + :: Name Owner + -> Name Repo + -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () +reRunWorkflowR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"] + mempty + +-- | Re-run failed jobs from a workflow run. +-- See +reRunFailedJobsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () +reRunFailedJobsR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"] + mempty + +-- | List workflow runs for a workflow. +-- See +workflowRunsForWorkflowR + :: Name Owner + -> Name Repo + -> Id Workflow + -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunsForWorkflowR user repo workflow = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "runs"] + [] diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 83ac1a5d..e4e8a7eb 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -72,34 +72,4 @@ enableWorkflowR -> GenRequest 'MtJSON 'RW Workflow enableWorkflowR user repo workflow = command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "enable"] - mempty - --- workflowRunsForR --- :: Name Owner --- -> Name Repo --- -> Name Workflow --- -- -> FetchCount --- -> Request k (ActionWorkflowRunResult ActionWorkflowRun) --- workflowRunsForR user repo workflowId = query --- ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflowId, "runs"] --- [] - --- -- | Create a pull request. --- -- See --- createWorkflowDispatchEventR :: (ToJSON a) => Name Owner --- -> Name Repo --- -> Name Workflow --- -> CreateWorkflowDispatchEvent a --- -> GenRequest 'MtUnit 'RW () --- createWorkflowDispatchEventR user repo workflowId cwde = --- Command Post ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflowId, "dispatches"] (encode cwde) - - --- workflowRunForR --- :: Name Owner --- -> Name Repo --- -> Id ActionWorkflowRun --- -> Request k (ActionWorkflowRun) --- workflowRunForR user repo runId = query --- ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runId] --- [] \ No newline at end of file + mempty \ No newline at end of file From 0661ca124f4e34cbdbccef1ef56f04630ec5819b Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sat, 12 Nov 2022 17:07:48 -0800 Subject: [PATCH 10/34] Format --- spec/GitHub/Actions/ArtifactsSpec.hs | 2 +- spec/GitHub/Actions/CacheSpec.hs | 2 +- spec/GitHub/Actions/SecretsSpec.hs | 2 +- src/GitHub/Data/Actions/Artifacts.hs | 4 +-- src/GitHub/Data/Actions/Cache.hs | 2 +- src/GitHub/Data/Actions/Secrets.hs | 18 ++++++------ src/GitHub/Data/Actions/WorkflowJobs.hs | 29 ++++++-------------- src/GitHub/Data/Actions/WorkflowRuns.hs | 22 +++++++-------- src/GitHub/Data/Actions/Workflows.hs | 6 ++-- src/GitHub/Endpoints/Actions/Cache.hs | 6 ++-- src/GitHub/Endpoints/Actions/Secrets.hs | 2 +- src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 4 +-- src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 24 ++++++++-------- src/GitHub/Endpoints/Actions/Workflows.hs | 2 +- 14 files changed, 56 insertions(+), 69 deletions(-) diff --git a/spec/GitHub/Actions/ArtifactsSpec.hs b/spec/GitHub/Actions/ArtifactsSpec.hs index db5fe077..872aafa6 100644 --- a/spec/GitHub/Actions/ArtifactsSpec.hs +++ b/spec/GitHub/Actions/ArtifactsSpec.hs @@ -63,4 +63,4 @@ spec = do artifactsListPayload = $(embedFile "fixtures/actions/artifacts-list.json") artifactPayload :: ByteString - artifactPayload = $(embedFile "fixtures/actions/artifact.json") \ No newline at end of file + artifactPayload = $(embedFile "fixtures/actions/artifact.json") diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs index 54d37527..1e720959 100644 --- a/spec/GitHub/Actions/CacheSpec.hs +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -55,4 +55,4 @@ spec = do repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") orgCacheUsagePayload :: ByteString - orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") \ No newline at end of file + orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs index 14ea521d..6fc015c0 100644 --- a/spec/GitHub/Actions/SecretsSpec.hs +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -55,4 +55,4 @@ spec = do -- repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") -- orgCacheUsagePayload :: ByteString - -- orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") \ No newline at end of file + -- orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index 55c31e34..6ff23489 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -16,9 +16,9 @@ import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () -import GitHub.Data.Repos (Repo) -import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) +import GitHub.Data.Repos (Repo) ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs index fc6c0134..83ad52fc 100644 --- a/src/GitHub/Data/Actions/Cache.hs +++ b/src/GitHub/Data/Actions/Cache.hs @@ -80,4 +80,4 @@ instance FromJSON RepositoryCacheUsage where instance FromJSON (WithTotalCount RepositoryCacheUsage) where parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount <$> o .: "repository_cache_usages" - <*> o .: "total_count" \ No newline at end of file + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index 2373db56..fca99868 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -21,10 +21,10 @@ import GitHub.Data.Id (Id) import GitHub.Internal.Prelude import Prelude () +import Data.Maybe (maybeToList) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) -import GitHub.Data.Name (Name) -import GitHub.Data.Repos (Repo) -import Data.Maybe (maybeToList) +import GitHub.Data.Name (Name) +import GitHub.Data.Repos (Repo) ------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ data PublicKey = PublicKey } deriving (Show, Data, Typeable, Eq, Ord, Generic) -data SetSecret = SetSecret +data SetSecret = SetSecret { setSecretPublicKeyId :: !(Id PublicKey) , setSecretEncryptedValue :: !Text , setSecretVisibility :: !Text @@ -59,7 +59,7 @@ data SelectedRepo = SelectedRepo } deriving (Show, Data, Typeable, Eq, Ord, Generic) -data SetSelectedRepositories = SetSelectedRepositories +data SetSelectedRepositories = SetSelectedRepositories { setSelectedRepositoriesRepositoryIds :: ![Id Repo] } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -105,14 +105,14 @@ instance ToJSON SetSelectedRepositories where toJSON SetSelectedRepositories{..} = object [ "selected_repository_ids" .= setSelectedRepositoriesRepositoryIds - ] + ] instance ToJSON SetSecret where toJSON SetSecret{..} = object $ - [ "encrypted_value" .= setSecretEncryptedValue + [ "encrypted_value" .= setSecretEncryptedValue , "key_id" .= setSecretPublicKeyId - , "visibility" .= setSecretVisibility + , "visibility" .= setSecretVisibility ] <> maybeToList (fmap ("selected_repository_ids" .=) setSecretSelectedRepositoryIds) instance FromJSON (WithTotalCount SelectedRepo) where @@ -124,4 +124,4 @@ instance FromJSON RepoSecret where parseJSON = withObject "RepoSecret" $ \o -> RepoSecret <$> o .: "name" <*> o .: "created_at" - <*> o .: "updated_at" \ No newline at end of file + <*> o .: "updated_at" diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs index 7e52ded7..b3524a10 100644 --- a/src/GitHub/Data/Actions/WorkflowJobs.hs +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -8,33 +8,20 @@ module GitHub.Data.Actions.WorkflowJobs ( ) where import GitHub.Data.Id (Id) +import GitHub.Data.Name (Name) import GitHub.Data.URL (URL) -import GitHub.Data.Name (Name) import GitHub.Internal.Prelude - ( ($), - Eq, - Data, - Ord, - Show, - Typeable, - Applicative((<*>)), - Generic, - Integer, - (<$>), - (.:), - withObject, - FromJSON(parseJSON), - Text, - UTCTime, - Vector ) + (Applicative ((<*>)), Data, Eq, FromJSON (parseJSON), Generic, Integer, + Ord, Show, Text, Typeable, UTCTime, Vector, withObject, ($), (.:), + (<$>)) import Prelude () +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) -import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) data JobStep = JobStep - { + { jobStepName :: !(Name JobStep) , jobStepStatus :: !Text , jobStepConclusion :: !Text @@ -45,7 +32,7 @@ data JobStep = JobStep deriving (Show, Data, Typeable, Eq, Ord, Generic) data Job = Job - { + { jobId :: !(Id Job) , jobRunId :: !(Id WorkflowRun) , jobRunUrl :: !URL @@ -107,4 +94,4 @@ instance FromJSON Job where instance FromJSON (WithTotalCount Job) where parseJSON = withObject "JobList" $ \o -> WithTotalCount <$> o .: "jobs" - <*> o .: "total_count" \ No newline at end of file + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 4abd4d48..d13cf725 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -14,18 +14,18 @@ module GitHub.Data.Actions.WorkflowRuns ( ReviewHistory(..), ) where -import GitHub.Data.Definitions -import GitHub.Data.Id (Id) -import GitHub.Data.Options (IssueState (..), MergeableState (..)) -import GitHub.Data.Repos (Repo) -import GitHub.Data.URL (URL) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Definitions +import GitHub.Data.Id (Id) +import GitHub.Data.Options (IssueState (..), MergeableState (..)) +import GitHub.Data.Repos (Repo) +import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () -import qualified Data.Text as T -import qualified Data.Vector as V -import GitHub.Data.PullRequests (SimplePullRequest) +import qualified Data.Text as T +import qualified Data.Vector as V +import GitHub.Data.PullRequests (SimplePullRequest) import GitHub.Data.Name (Name) @@ -55,7 +55,7 @@ data WorkflowRun = WorkflowRun deriving (Show, Data, Typeable, Eq, Ord, Generic) data RunAttempt = RunAttempt - -- { + -- { -- jobId :: !(Id Job) -- , runRunId :: !(Id WorkflowRun) -- , workflowPath :: !Text @@ -76,7 +76,7 @@ data ReviewHistory = ReviewHistory } deriving (Show, Data, Typeable, Eq, Ord, Generic) -- data RunCommit = RunCommit --- { +-- { -- runCommitId :: !Text -- , runCommitTreeId :: !Text -- } @@ -201,4 +201,4 @@ instance FromJSON WorkflowRun where <*> o .: "attempt" <*> o .: "started_at" <*> o .: "trigerring_actor" - <*> o .: "repository" \ No newline at end of file + <*> o .: "repository" diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index 920fe65c..068e0312 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -7,14 +7,14 @@ module GitHub.Data.Actions.Workflows ( CreateWorkflowDispatchEvent(..), ) where -import GitHub.Data.Id (Id) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Id (Id) import GitHub.Internal.Prelude import Prelude () data Workflow = Workflow - { + { workflowWorkflowId :: !(Id Workflow) , workflowName :: !Text , workflowPath :: !Text @@ -60,4 +60,4 @@ instance FromJSON (WithTotalCount Workflow) where instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where toJSON (CreateWorkflowDispatchEvent ref inputs) = - object [ "ref" .= ref, "inputs" .= inputs ] \ No newline at end of file + object [ "ref" .= ref, "inputs" .= inputs ] diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs index 5acbf13b..af3688ca 100644 --- a/src/GitHub/Endpoints/Actions/Cache.hs +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -26,7 +26,7 @@ cacheUsageOrganizationR org = -- | Get Actions cache usage for the organization. -- See -cacheUsageByRepositoryR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) +cacheUsageByRepositoryR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) cacheUsageByRepositoryR org = PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] [] @@ -43,7 +43,7 @@ cachesForRepoR -> Name Repo -> CacheMod -> FetchCount - -> GenRequest 'MtJSON 'RA (WithTotalCount Cache) + -> GenRequest 'MtJSON 'RA (WithTotalCount Cache) cachesForRepoR user repo opts = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "caches"] (cacheModToQueryString opts) @@ -64,4 +64,4 @@ deleteCacheR :: Name Owner -> Name Repo -> Id Cache -> GenRequest 'MtUnit 'RW () deleteCacheR user repo cacheid = Command Delete parts mempty where - parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches", toPathPart cacheid] \ No newline at end of file + parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches", toPathPart cacheid] diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs index 85b3b8ab..61b365de 100644 --- a/src/GitHub/Endpoints/Actions/Secrets.hs +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -150,4 +150,4 @@ deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> Re deleteEnvironmentSecretR repo env name = command Delete parts mempty where - parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] \ No newline at end of file + parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs index 643b1331..4cb36fb3 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -15,8 +15,8 @@ module GitHub.Endpoints.Actions.WorkflowJobs ( import GitHub.Data import GitHub.Internal.Prelude +import Network.URI (URI) import Prelude () -import Network.URI (URI) -- | Get a job for a workflow run. -- See @@ -40,4 +40,4 @@ jobsForWorkflowRunAttemptR owner repo run attempt = -- See jobsForWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount Job) jobsForWorkflowRunR owner repo run = - PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] [] \ No newline at end of file + PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] [] diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs index 7351d682..d6b8e13f 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -25,8 +25,8 @@ module GitHub.Endpoints.Actions.WorkflowRuns ( import GitHub.Data import GitHub.Internal.Prelude +import Network.URI (URI) import Prelude () -import Network.URI (URI) -- | Re-run a job from a workflow run. -- See @@ -34,7 +34,7 @@ reRunJobR :: Name Owner -> Name Repo -> Id Job -> GenRequest 'MtJSON 'RW () -reRunJobR user repo job = Command Post +reRunJobR user repo job = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"] mempty @@ -44,7 +44,7 @@ workflowRunsR :: Name Owner -> Name Repo -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunsR user repo = PagedQuery +workflowRunsR user repo = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "runs"] [] @@ -55,7 +55,7 @@ workflowRunR -> Name Repo -> Id WorkflowRun -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunR user repo run = Query +workflowRunR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] [] @@ -77,7 +77,7 @@ workflowRunReviewHistoryR -> Name Repo -> Id WorkflowRun -> GenRequest 'MtJSON 'RA (Vector ReviewHistory) -workflowRunReviewHistoryR user repo run = Query +workflowRunReviewHistoryR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approvals"] [] @@ -100,7 +100,7 @@ workflowRunAttemptR -> Id WorkflowRun -> Id RunAttempt -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunAttemptR user repo run attempt = Query +workflowRunAttemptR user repo run attempt = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt] [] @@ -112,7 +112,7 @@ downloadWorkflowRunAttemptLogsR -> Id WorkflowRun -> Id RunAttempt -> GenRequest 'MtRedirect 'RO URI -downloadWorkflowRunAttemptLogsR user repo run attempt = Query +downloadWorkflowRunAttemptLogsR user repo run attempt = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "logs"] [] @@ -134,7 +134,7 @@ downloadWorkflowRunLogsR -> Name Repo -> Id WorkflowRun -> GenRequest 'MtRedirect 'RO URI -downloadWorkflowRunLogsR user repo run = Query +downloadWorkflowRunLogsR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] [] @@ -155,7 +155,7 @@ reRunWorkflowR :: Name Owner -> Name Repo -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () -reRunWorkflowR user repo run = Command Post +reRunWorkflowR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"] mempty @@ -165,7 +165,7 @@ reRunFailedJobsR :: Name Owner -> Name Repo -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () -reRunFailedJobsR user repo run = Command Post +reRunFailedJobsR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"] mempty @@ -174,8 +174,8 @@ reRunFailedJobsR user repo run = Command Post workflowRunsForWorkflowR :: Name Owner -> Name Repo - -> Id Workflow + -> Id Workflow -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunsForWorkflowR user repo workflow = PagedQuery +workflowRunsForWorkflowR user repo workflow = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "runs"] [] diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index e4e8a7eb..72781666 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -72,4 +72,4 @@ enableWorkflowR -> GenRequest 'MtJSON 'RW Workflow enableWorkflowR user repo workflow = command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "enable"] - mempty \ No newline at end of file + mempty From ed61cc117c5d3db5a6d5a2dffd4468ff00eae6a5 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 13 Nov 2022 20:29:31 -0800 Subject: [PATCH 11/34] Artifacts QA. --- spec/GitHub/Actions/ArtifactsSpec.hs | 2 +- src/GitHub/Data.hs | 16 -------- src/GitHub/Data/Actions/Artifacts.hs | 2 +- src/GitHub/Data/Actions/Common.hs | 16 -------- src/GitHub/Data/Options.hs | 48 +++++++++++++++++++++++ src/GitHub/Endpoints/Actions/Artifacts.hs | 14 +++---- 6 files changed, 57 insertions(+), 41 deletions(-) diff --git a/spec/GitHub/Actions/ArtifactsSpec.hs b/spec/GitHub/Actions/ArtifactsSpec.hs index 872aafa6..f64fde29 100644 --- a/spec/GitHub/Actions/ArtifactsSpec.hs +++ b/spec/GitHub/Actions/ArtifactsSpec.hs @@ -43,7 +43,7 @@ spec = do V.length (GH.withTotalCountItems artifactList) `shouldBe` 2 it "decodes signle artifact payload" $ do GH.artifactName artifact `shouldBe` "dist-without-markdown" - GH.workflowRunHeadSha (GH.workflowRun artifact) `shouldBe` "601593ecb1d8a57a04700fdb445a28d4186b8954" + GH.artifactWorkflowRunHeadSha (GH.artifactWorkflowRun artifact) `shouldBe` "601593ecb1d8a57a04700fdb445a28d4186b8954" where repos = diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index e56b089a..8fe3fe6f 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -19,10 +19,6 @@ module GitHub.Data ( mkCommitName, fromUserName, fromOrganizationName, - mkWorkflowName, - mkWorkflowId, - -- mkWorkflowRunId, - -- mkWorkflowRunName, -- ** Id Id, mkId, @@ -159,15 +155,3 @@ fromOrganizationId = Id . untagId fromUserId :: Id User -> Id Owner fromUserId = Id . untagId - -mkWorkflowId :: Int -> Id Workflow -mkWorkflowId = Id - -mkWorkflowName :: Text -> Name Workflow -mkWorkflowName = N - --- mkWorkflowRunId :: Int -> Id ActionWorkflowRun --- mkWorkflowRunId = Id - --- mkWorkflowRunName :: Text -> Name ActionWorkflowRun --- mkWorkflowRunName = N diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index 6ff23489..fba3c577 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -44,7 +44,7 @@ data Artifact = Artifact , artifactSizeInBytes :: !Int , artifactUpdatedAt :: !UTCTime , artifactUrl :: !URL - , workflowRun :: !ArtifactWorkflowRun + , artifactWorkflowRun :: !ArtifactWorkflowRun } deriving (Show, Data, Typeable, Eq, Ord, Generic) diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index ed935639..f93133eb 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -7,7 +7,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} module GitHub.Data.Actions.Common ( - PaginatedWithTotalCount(..), WithTotalCount(..), ) where @@ -23,11 +22,6 @@ import qualified Data.Text as T -- Common ------------------------------------------------------------------------------- -data PaginatedWithTotalCount a (tag :: Symbol) = PaginatedWithTotalCount - { paginatedWithTotalCountItems :: !(Vector a) - , paginatedWithTotalCountTotalCount :: !Int - } - data WithTotalCount a = WithTotalCount { withTotalCountItems :: !(Vector a) , withTotalCountTotalCount :: !Int @@ -39,13 +33,3 @@ instance Semigroup (WithTotalCount a) where instance Foldable WithTotalCount where foldMap f (WithTotalCount items _) = foldMap f items - -------------------------------------------------------------------------------- --- JSON instances -------------------------------------------------------------------------------- - - -instance (FromJSON a, KnownSymbol l) => FromJSON (PaginatedWithTotalCount a l) where - parseJSON = withObject "PaginatedWithTotalCount" $ \o -> PaginatedWithTotalCount - <$> o .: T.pack (symbolVal (Proxy :: Proxy l)) - <*> o .: "total_count" diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 93302192..b0678022 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -49,6 +49,10 @@ module GitHub.Data.Options ( optionsAnyAssignee, optionsNoAssignee, optionsAssignee, + -- * Actions artifacts + ArtifactMod, + artifactModToQueryString, + optionsArtifactName, -- * Actions cache CacheMod, cacheModToQueryString, @@ -667,6 +671,50 @@ optionsAssignee u = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterBy u } ------------------------------------------------------------------------------- +-- Actions artifacts +------------------------------------------------------------------------------- +-- | See . +data ArtifactOptions = ArtifactOptions + { artifactOptionsName :: !(Maybe Text) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultArtifactOptions :: ArtifactOptions +defaultArtifactOptions = ArtifactOptions + { artifactOptionsName = Nothing + } + +-- | See . +newtype ArtifactMod = ArtifactMod (ArtifactOptions -> ArtifactOptions) + +instance Semigroup ArtifactMod where + ArtifactMod f <> ArtifactMod g = ArtifactMod (g . f) + +instance Monoid ArtifactMod where + mempty = ArtifactMod id + mappend = (<>) + +-- | Filters artifacts by exact match on their name field. +optionsArtifactName :: Text -> ArtifactMod +optionsArtifactName n = ArtifactMod $ \opts -> + opts { artifactOptionsName = Just n } + +toArtifactOptions :: ArtifactMod -> ArtifactOptions +toArtifactOptions (ArtifactMod f) = f defaultArtifactOptions + +artifactModToQueryString :: ArtifactMod -> QueryString +artifactModToQueryString = artifactOptionsToQueryString . toArtifactOptions + +artifactOptionsToQueryString :: ArtifactOptions -> QueryString +artifactOptionsToQueryString (ArtifactOptions name) = + catMaybes + [ mk "name" <$> name' + ] + where + mk k v = (k, Just v) + name' = fmap TE.encodeUtf8 name +------------------------------------------------------------------------------- -- Actions cache ------------------------------------------------------------------------------- diff --git a/src/GitHub/Endpoints/Actions/Artifacts.hs b/src/GitHub/Endpoints/Actions/Artifacts.hs index 833db825..b3cbb399 100644 --- a/src/GitHub/Endpoints/Actions/Artifacts.hs +++ b/src/GitHub/Endpoints/Actions/Artifacts.hs @@ -18,23 +18,23 @@ import GitHub.Data import GitHub.Internal.Prelude import Network.URI (URI) import Prelude () --- import GitHub.Data.Actions (ActionWorkflow, ActionWorkflowResult, ActionWorkflowRun, Workflow, ActionWorkflowRunResult, CreateWorkflowDispatchEvent) -- | List artifacts for repository. -- See artifactsForR :: Name Owner -> Name Repo + -> ArtifactMod -> FetchCount - -> Request k (WithTotalCount Artifact) -artifactsForR user repo = PagedQuery + -> Request 'RA (WithTotalCount Artifact) +artifactsForR user repo opts = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] - [] + (artifactModToQueryString opts) --- | Query a single artifact. +-- | Get an artifact. -- See -artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request k Artifact +artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request 'RA Artifact artifactR user repo artid = query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] [] @@ -59,7 +59,7 @@ artifactsForWorkflowRunR -> Name Repo -> Id WorkflowRun -> FetchCount - -> Request k (WithTotalCount Artifact) + -> Request 'RA (WithTotalCount Artifact) artifactsForWorkflowRunR user repo runid = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runid, "artifacts"] [] From 50f7fa1e39751e44360e2cef10f7d041a0d46dc0 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 13 Nov 2022 20:45:48 -0800 Subject: [PATCH 12/34] Cache QA. --- spec/GitHub/Actions/ArtifactsSpec.hs | 2 +- src/GitHub.hs | 13 +++++++++++-- src/GitHub/Data/Options.hs | 2 +- src/GitHub/Endpoints/Actions/Cache.hs | 14 ++------------ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/spec/GitHub/Actions/ArtifactsSpec.hs b/spec/GitHub/Actions/ArtifactsSpec.hs index f64fde29..c3df8031 100644 --- a/spec/GitHub/Actions/ArtifactsSpec.hs +++ b/spec/GitHub/Actions/ArtifactsSpec.hs @@ -34,7 +34,7 @@ spec = do describe "artifactsForR" $ do it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do cs <- GH.executeRequest auth $ - GH.artifactsForR owner repo GH.FetchAll + GH.artifactsForR owner repo mempty GH.FetchAll cs `shouldSatisfy` isRight describe "decoding artifacts payloads" $ do diff --git a/src/GitHub.hs b/src/GitHub.hs index d990abfb..72d53c23 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -413,14 +413,22 @@ module GitHub ( -- | See rateLimitR, - -- ** Actions - -- | See + -- ** Actions - artifacts + -- | See artifactsForR, artifactR, deleteArtifactR, downloadArtifactR, artifactsForWorkflowRunR, + -- ** Actions - cache + -- | See + cacheUsageOrganizationR, + cacheUsageByRepositoryR, + cacheUsageR, + cachesForRepoR, + deleteCacheR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -429,6 +437,7 @@ module GitHub ( import GitHub.Data import GitHub.Endpoints.Actions.Artifacts +import GitHub.Endpoints.Actions.Cache import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index b0678022..67b0518b 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -773,7 +773,7 @@ cacheOptionsToQueryString (CacheOptions ref key sort dir) = key' = fmap TE.encodeUtf8 key ------------------------------------------------------------------------------- --- Pull request modifiers +-- Cache modifiers ------------------------------------------------------------------------------- optionsRef :: Text -> CacheMod diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs index af3688ca..e58639a7 100644 --- a/src/GitHub/Endpoints/Actions/Cache.hs +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -24,13 +24,13 @@ cacheUsageOrganizationR :: Name Organization -> GenRequest 'MtJSON 'RA Organizat cacheUsageOrganizationR org = Query ["orgs", toPathPart org, "actions", "cache", "usage"] [] --- | Get Actions cache usage for the organization. +-- | List repositories with GitHub Actions cache usage for an organization. -- See cacheUsageByRepositoryR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) cacheUsageByRepositoryR org = PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] [] --- | Get Actions cache usage for the repository. +-- | Get GitHub Actions cache usage for a repository. -- See cacheUsageR :: Name Owner -> Name Repo -> Request k RepositoryCacheUsage cacheUsageR user repo = @@ -48,16 +48,6 @@ cachesForRepoR user repo opts = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "caches"] (cacheModToQueryString opts) --- | Delete GitHub Actions cache for a repository. --- See --- TODO: No querystring for Commands??? --- TODO: return value --- deleteCachesKeyR :: Name Owner -> Name Repo -> String -> Maybe String -> GenRequest 'MtUnit 'RW () --- deleteCachesKeyR user repo key ref = --- Command Delete parts mempty --- where --- parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches"] - -- | Delete GitHub Actions cache for a repository. -- See deleteCacheR :: Name Owner -> Name Repo -> Id Cache -> GenRequest 'MtUnit 'RW () From d02bed9223d9210133a16a17e6261b0d2e2979ca Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 17:21:18 -0800 Subject: [PATCH 13/34] Secrets QA. --- spec/GitHub/Actions/SecretsSpec.hs | 20 ----------- src/GitHub.hs | 23 +++++++++++++ src/GitHub/Data/Actions/Common.hs | 3 -- src/GitHub/Data/Actions/Secrets.hs | 27 ++++++++++++--- src/GitHub/Endpoints/Actions/Secrets.hs | 44 ++++++++++++------------- 5 files changed, 68 insertions(+), 49 deletions(-) diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs index 6fc015c0..f4cb6d84 100644 --- a/spec/GitHub/Actions/SecretsSpec.hs +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -27,32 +27,12 @@ spec = do describe "decoding secrets payloads" $ do it "decodes selected repo list payload" $ do V.length (GH.withTotalCountItems repoList) `shouldBe` 1 - -- it "decodes cache usage for repo" $ do - -- GH.repositoryCacheUsageFullName repoCacheUsage `shouldBe` "python/cpython" - -- GH.repositoryCacheUsageActiveCachesSizeInBytes repoCacheUsage `shouldBe` 55000268087 - -- GH.repositoryCacheUsageActiveCachesCount repoCacheUsage `shouldBe` 171 - -- it "decodes cache usage for org" $ do - -- GH.organizationCacheUsageTotalActiveCachesSizeInBytes orgCacheUsage `shouldBe` 26586 - -- GH.organizationCacheUsageTotalActiveCachesCount orgCacheUsage `shouldBe` 1 where repoList :: GH.WithTotalCount GH.SelectedRepo repoList = fromRightS (eitherDecodeStrict repoListPayload) - -- repoCacheUsage :: GH.RepositoryCacheUsage - -- repoCacheUsage = - -- fromRightS (eitherDecodeStrict repoCacheUsagePayload) - - -- orgCacheUsage :: GH.OrganizationCacheUsage - -- orgCacheUsage = - -- fromRightS (eitherDecodeStrict orgCacheUsagePayload) repoListPayload :: ByteString repoListPayload = $(embedFile "fixtures/actions/selected-repositories-for-secret.json") - - -- repoCacheUsagePayload :: ByteString - -- repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") - - -- orgCacheUsagePayload :: ByteString - -- orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") diff --git a/src/GitHub.hs b/src/GitHub.hs index 72d53c23..88412b0f 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -429,6 +429,28 @@ module GitHub ( cachesForRepoR, deleteCacheR, + -- ** Actions - secrets + -- | See + organizationSecretsR, + organizationPublicKeyR, + organizationSecretR, + setOrganizationSecretR, + deleteOrganizationSecretR, + organizationSelectedRepositoriesForSecretR, + setOrganizationSelectedRepositoriesForSecretR, + addOrganizationSelectedRepositoriesForSecretR, + removeOrganizationSelectedRepositoriesForSecretR, + repoSecretsR, + repoPublicKeyR, + repoSecretR, + setRepoSecretR, + deleteRepoSecretR, + environmentSecretsR, + environmentPublicKeyR, + environmentSecretR, + setEnvironmentSecretR, + deleteEnvironmentSecretR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -438,6 +460,7 @@ module GitHub ( import GitHub.Data import GitHub.Endpoints.Actions.Artifacts import GitHub.Endpoints.Actions.Cache +import GitHub.Endpoints.Actions.Secrets import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index f93133eb..62d73c80 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -11,12 +11,9 @@ module GitHub.Data.Actions.Common ( ) where -import GHC.TypeLits import GitHub.Internal.Prelude import Prelude () -import Data.Data (Proxy (..)) -import qualified Data.Text as T ------------------------------------------------------------------------------- -- Common diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index fca99868..e97d5397 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -11,6 +11,7 @@ module GitHub.Data.Actions.Secrets ( OrganizationSecret(..), PublicKey(..), SetSecret(..), + SetRepoSecret(..), SelectedRepo(..), SetSelectedRepositories(..), RepoSecret(..), @@ -32,7 +33,7 @@ import GitHub.Data.Repos (Repo) ------------------------------------------------------------------------------- data OrganizationSecret = OrganizationSecret - { organizationSecretNmae :: !(Name OrganizationSecret) + { organizationSecretName :: !(Name OrganizationSecret) , organizationSecretCreatedAt :: !UTCTime , organizationSecretUpdatedAt :: !UTCTime , organizationSecretVisibility :: !Text @@ -40,19 +41,25 @@ data OrganizationSecret = OrganizationSecret deriving (Show, Data, Typeable, Eq, Ord, Generic) data PublicKey = PublicKey - { publicKeyId :: !(Id PublicKey) + { publicKeyId :: !Text , publicKeyKey :: !Text } deriving (Show, Data, Typeable, Eq, Ord, Generic) data SetSecret = SetSecret - { setSecretPublicKeyId :: !(Id PublicKey) + { setSecretPublicKeyId :: !Text , setSecretEncryptedValue :: !Text , setSecretVisibility :: !Text , setSecretSelectedRepositoryIds :: !(Maybe [Id Repo]) } deriving (Show, Data, Typeable, Eq, Ord, Generic) +data SetRepoSecret = SetRepoSecret + { setRepoSecretPublicKeyId :: !Text + , setRepoSecretEncryptedValue :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + data SelectedRepo = SelectedRepo { selectedRepoRepoId :: !(Id Repo) , selectedRepoRepoName :: !(Name Repo) @@ -65,7 +72,7 @@ data SetSelectedRepositories = SetSelectedRepositories deriving (Show, Data, Typeable, Eq, Ord, Generic) data RepoSecret = RepoSecret - { repoSecretNmae :: !(Name RepoSecret) + { repoSecretName :: !(Name RepoSecret) , repoSecretCreatedAt :: !UTCTime , repoSecretUpdatedAt :: !UTCTime } @@ -115,6 +122,13 @@ instance ToJSON SetSecret where , "visibility" .= setSecretVisibility ] <> maybeToList (fmap ("selected_repository_ids" .=) setSecretSelectedRepositoryIds) +instance ToJSON SetRepoSecret where + toJSON SetRepoSecret{..} = + object + [ "encrypted_value" .= setRepoSecretEncryptedValue + , "key_id" .= setRepoSecretPublicKeyId + ] + instance FromJSON (WithTotalCount SelectedRepo) where parseJSON = withObject "SelectedRepoList" $ \o -> WithTotalCount <$> o .: "repositories" @@ -125,3 +139,8 @@ instance FromJSON RepoSecret where <$> o .: "name" <*> o .: "created_at" <*> o .: "updated_at" + +instance FromJSON (WithTotalCount RepoSecret) where + parseJSON = withObject "RepoSecretList" $ \o -> WithTotalCount + <$> o .: "secrets" + <*> o .: "total_count" \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs index 61b365de..f67942de 100644 --- a/src/GitHub/Endpoints/Actions/Secrets.hs +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -34,9 +34,9 @@ import Prelude () -- | List organization secrets. -- See -organizationSecretsR :: Name Organization -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) +organizationSecretsR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) organizationSecretsR org = - Query ["orgs", toPathPart org, "actions", "secrets"] [] + PagedQuery ["orgs", toPathPart org, "actions", "secrets"] [] -- | List organization secrets. -- See @@ -52,41 +52,41 @@ organizationSecretR org name = -- | Create or update an organization secret. -- See -setOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> SetSecret -> GenRequest 'MtJSON 'RW () +setOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> SetSecret -> GenRequest 'MtUnit 'RW () setOrganizationSecretR org name = - command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete an organization secret. -- See -deleteOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> Request 'RW () +deleteOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtUnit 'RW () deleteOrganizationSecretR org name = - command Delete parts mempty + Command Delete parts mempty where parts = ["orgs", toPathPart org, "actions", "secrets", toPathPart name] -- | Get selected repositories for an organization secret. -- See -organizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) +organizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) organizationSelectedRepositoriesForSecretR org name = - Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] + PagedQuery ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] -- | Set selected repositories for an organization secret. -- See -setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> SetSelectedRepositories -> GenRequest 'MtJSON 'RW () +setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> SetSelectedRepositories -> GenRequest 'MtUnit 'RW () setOrganizationSelectedRepositoriesForSecretR org name = - command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode -- | Add selected repository to an organization secret. -- See -addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtJSON 'RW () +addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtUnit 'RW () addOrganizationSelectedRepositoriesForSecretR org name repo = - command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty -- | Remove selected repository from an organization secret. -- See -removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtJSON 'RW () +removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtUnit 'RW () removeOrganizationSelectedRepositoriesForSecretR org name repo = - command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + Command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty -- | List repository secrets. -- See @@ -108,15 +108,15 @@ repoSecretR user org name = -- | Create or update a repository secret. -- See -setRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> SetSecret -> GenRequest 'MtJSON 'RW () +setRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> SetRepoSecret -> GenRequest 'MtUnit 'RW () setRepoSecretR user org name = - command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode + Command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete a repository secret. -- See -deleteRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> Request 'RW () +deleteRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> GenRequest 'MtUnit 'RW () deleteRepoSecretR user org name = - command Delete parts mempty + Command Delete parts mempty where parts = ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] @@ -140,14 +140,14 @@ environmentSecretR repo env name = -- | Create or update an environment secret. -- See -setEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> SetSecret -> GenRequest 'MtJSON 'RW () +setEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> SetRepoSecret -> GenRequest 'MtUnit 'RW () setEnvironmentSecretR repo env name = - command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode + Command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode -- | Delete an environment secret. -- See -deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> Request 'RW () +deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> GenRequest 'MtUnit 'RW () deleteEnvironmentSecretR repo env name = - command Delete parts mempty + Command Delete parts mempty where parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] From 90ac4b40ddde5526f34b08c1d5da78fdbe48d000 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 20:21:01 -0800 Subject: [PATCH 14/34] WorkflowJobs QA. --- fixtures/actions/org-secret.json | 7 ----- github.cabal | 1 + spec/GitHub/Actions/CacheSpec.hs | 8 ++--- spec/GitHub/Actions/SecretsSpec.hs | 17 ++++++++++ spec/GitHub/Actions/WorkflowJobSpec.hs | 33 ++++++++++++++++++++ src/GitHub.hs | 8 +++++ src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 3 +- 7 files changed, 62 insertions(+), 15 deletions(-) delete mode 100644 fixtures/actions/org-secret.json create mode 100644 spec/GitHub/Actions/WorkflowJobSpec.hs diff --git a/fixtures/actions/org-secret.json b/fixtures/actions/org-secret.json deleted file mode 100644 index bf6f795f..00000000 --- a/fixtures/actions/org-secret.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "TEST_SECRET", - "created_at": "2022-10-31T00:08:12Z", - "updated_at": "2022-10-31T00:08:12Z", - "visibility": "all" -} - \ No newline at end of file diff --git a/github.cabal b/github.cabal index c6cc8328..c741884a 100644 --- a/github.cabal +++ b/github.cabal @@ -236,6 +236,7 @@ test-suite github-test GitHub.Actions.ArtifactsSpec GitHub.Actions.CacheSpec GitHub.Actions.SecretsSpec + GitHub.Actions.WorkflowJobSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs index 1e720959..07905d9c 100644 --- a/spec/GitHub/Actions/CacheSpec.hs +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -9,14 +9,10 @@ import Prelude.Compat import Data.Aeson (eitherDecodeStrict) import Data.ByteString (ByteString) -import Data.Either.Compat (isRight) import Data.FileEmbed (embedFile) -import Data.Foldable (for_) -import Data.String (fromString) -import qualified Data.Vector as V -import System.Environment (lookupEnv) +import qualified Data.Vector as V import Test.Hspec - (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs index f4cb6d84..f9cf4d17 100644 --- a/spec/GitHub/Actions/SecretsSpec.hs +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -27,12 +27,29 @@ spec = do describe "decoding secrets payloads" $ do it "decodes selected repo list payload" $ do V.length (GH.withTotalCountItems repoList) `shouldBe` 1 + it "decodes secret list payload" $ do + V.length (GH.withTotalCountItems orgSecretList) `shouldBe` 2 + it "decodes public key payload" $ do + GH.publicKeyId orgPublicKey `shouldBe` "568250167242549743" where repoList :: GH.WithTotalCount GH.SelectedRepo repoList = fromRightS (eitherDecodeStrict repoListPayload) + orgSecretList:: GH.WithTotalCount GH.OrganizationSecret + orgSecretList= + fromRightS (eitherDecodeStrict orgSecretListPayload) + + orgPublicKey:: GH.PublicKey + orgPublicKey= + fromRightS (eitherDecodeStrict orgPublicKeyPayload) repoListPayload :: ByteString repoListPayload = $(embedFile "fixtures/actions/selected-repositories-for-secret.json") + + orgSecretListPayload :: ByteString + orgSecretListPayload = $(embedFile "fixtures/actions/org-secrets-list.json") + + orgPublicKeyPayload :: ByteString + orgPublicKeyPayload = $(embedFile "fixtures/actions/org-public-key.json") \ No newline at end of file diff --git a/spec/GitHub/Actions/WorkflowJobSpec.hs b/spec/GitHub/Actions/WorkflowJobSpec.hs new file mode 100644 index 00000000..8cc9a4e2 --- /dev/null +++ b/spec/GitHub/Actions/WorkflowJobSpec.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowJobSpec where + +import qualified GitHub as GH +import GitHub.Data.Id + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import Test.Hspec + (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow jobs payloads" $ do + it "decodes workflow job" $ do + GH.jobId workflowJob `shouldBe` Id 9183275828 + + where + workflowJob:: GH.Job + workflowJob= + fromRightS (eitherDecodeStrict workflowJobPayload) + + workflowJobPayload :: ByteString + workflowJobPayload = $(embedFile "fixtures/actions/workflow-job.json") \ No newline at end of file diff --git a/src/GitHub.hs b/src/GitHub.hs index 88412b0f..7a6342d9 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -451,6 +451,13 @@ module GitHub ( setEnvironmentSecretR, deleteEnvironmentSecretR, + -- ** Actions - workflow jobs + -- | See + jobR, + downloadJobLogsR, + jobsForWorkflowRunAttemptR, + jobsForWorkflowRunR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -461,6 +468,7 @@ import GitHub.Data import GitHub.Endpoints.Actions.Artifacts import GitHub.Endpoints.Actions.Cache import GitHub.Endpoints.Actions.Secrets +import GitHub.Endpoints.Actions.WorkflowJobs import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs index 4cb36fb3..fda2a6d8 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -14,13 +14,12 @@ module GitHub.Endpoints.Actions.WorkflowJobs ( ) where import GitHub.Data -import GitHub.Internal.Prelude import Network.URI (URI) import Prelude () -- | Get a job for a workflow run. -- See -jobR :: Name Owner -> Name Repo -> Id Job -> Request 'RO Job +jobR :: Name Owner -> Name Repo -> Id Job -> Request 'RA Job jobR owner repo job = Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job] [] From d56b38d2fd2c2e9a6984f79d0227f07261273c1c Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 21:48:23 -0800 Subject: [PATCH 15/34] Workflows QA. --- github.cabal | 2 + spec/GitHub/Actions/SecretsSpec.hs | 6 +- spec/GitHub/Actions/WorkflowRunsSpec.hs | 33 +++++ spec/GitHub/Actions/WorkflowSpec.hs | 33 +++++ src/GitHub.hs | 27 ++++ src/GitHub/Data/Actions/WorkflowRuns.hs | 146 ++----------------- src/GitHub/Data/Actions/Workflows.hs | 7 +- src/GitHub/Data/Options.hs | 98 +++++++++++++ src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 30 ++-- src/GitHub/Endpoints/Actions/Workflows.hs | 12 +- 10 files changed, 235 insertions(+), 159 deletions(-) create mode 100644 spec/GitHub/Actions/WorkflowRunsSpec.hs create mode 100644 spec/GitHub/Actions/WorkflowSpec.hs diff --git a/github.cabal b/github.cabal index c741884a..5c0a0917 100644 --- a/github.cabal +++ b/github.cabal @@ -237,6 +237,8 @@ test-suite github-test GitHub.Actions.CacheSpec GitHub.Actions.SecretsSpec GitHub.Actions.WorkflowJobSpec + GitHub.Actions.WorkflowRunsSpec + GitHub.Actions.WorkflowSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs index f9cf4d17..d0df9fa5 100644 --- a/spec/GitHub/Actions/SecretsSpec.hs +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -9,14 +9,10 @@ import Prelude.Compat import Data.Aeson (eitherDecodeStrict) import Data.ByteString (ByteString) -import Data.Either.Compat (isRight) import Data.FileEmbed (embedFile) -import Data.Foldable (for_) -import Data.String (fromString) import qualified Data.Vector as V -import System.Environment (lookupEnv) import Test.Hspec - (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b diff --git a/spec/GitHub/Actions/WorkflowRunsSpec.hs b/spec/GitHub/Actions/WorkflowRunsSpec.hs new file mode 100644 index 00000000..8e3d668a --- /dev/null +++ b/spec/GitHub/Actions/WorkflowRunsSpec.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowRunsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import qualified Data.Vector as V +import Data.FileEmbed (embedFile) +import Test.Hspec + (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow runs payloads" $ do + it "decodes workflow runs list" $ do + V.length (GH.withTotalCountItems workflowRunsList) `shouldBe` 3 + + where + workflowRunsList:: GH.WithTotalCount GH.WorkflowRun + workflowRunsList = + fromRightS (eitherDecodeStrict workflowRunsPayload) + + workflowRunsPayload :: ByteString + workflowRunsPayload = $(embedFile "fixtures/actions/workflow-runs-list.json") \ No newline at end of file diff --git a/spec/GitHub/Actions/WorkflowSpec.hs b/spec/GitHub/Actions/WorkflowSpec.hs new file mode 100644 index 00000000..fffa8839 --- /dev/null +++ b/spec/GitHub/Actions/WorkflowSpec.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import qualified Data.Vector as V +import Data.FileEmbed (embedFile) +import Test.Hspec + (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow payloads" $ do + it "decodes workflow list" $ do + V.length (GH.withTotalCountItems workflowList) `shouldBe` 1 + + where + workflowList:: GH.WithTotalCount GH.Workflow + workflowList = + fromRightS (eitherDecodeStrict workflowPayload) + + workflowPayload :: ByteString + workflowPayload = $(embedFile "fixtures/actions/workflow-list.json") \ No newline at end of file diff --git a/src/GitHub.hs b/src/GitHub.hs index 7a6342d9..b46c09a5 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -458,6 +458,31 @@ module GitHub ( jobsForWorkflowRunAttemptR, jobsForWorkflowRunR, + -- ** Actions - workflow runs + -- | See + reRunJobR, + workflowRunsR, + workflowRunR, + deleteWorkflowRunR, + workflowRunReviewHistoryR, + approveWorkflowRunR, + workflowRunAttemptR, + downloadWorkflowRunAttemptLogsR, + cancelWorkflowRunR, + downloadWorkflowRunLogsR, + deleteWorkflowRunLogsR, + reRunWorkflowR, + reRunFailedJobsR, + workflowRunsForWorkflowR, + + -- ** Actions - workflows + -- | See + repositoryWorkflowsR, + workflowR, + disableWorkflowR, + triggerWorkflowR, + enableWorkflowR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -469,6 +494,8 @@ import GitHub.Endpoints.Actions.Artifacts import GitHub.Endpoints.Actions.Cache import GitHub.Endpoints.Actions.Secrets import GitHub.Endpoints.Actions.WorkflowJobs +import GitHub.Endpoints.Actions.WorkflowRuns +import GitHub.Endpoints.Actions.Workflows import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index d13cf725..553179ea 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -1,14 +1,8 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} -{-# LANGUAGE RecordWildCards #-} module GitHub.Data.Actions.WorkflowRuns ( - -- Workflow(..), - -- ActionWorkflowResult(..), - -- ActionWorkflowRun(..), - -- Workflow, - -- ActionWorkflowRunResult(..), WorkflowRun(..), RunAttempt(..), ReviewHistory(..), @@ -16,18 +10,13 @@ module GitHub.Data.Actions.WorkflowRuns ( import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Definitions -import GitHub.Data.Id (Id) -import GitHub.Data.Options (IssueState (..), MergeableState (..)) -import GitHub.Data.Repos (Repo) import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () - -import qualified Data.Text as T -import qualified Data.Vector as V import GitHub.Data.PullRequests (SimplePullRequest) import GitHub.Data.Name (Name) +import GitHub.Data.Id (Id) data WorkflowRun = WorkflowRun { workflowRunWorkflowRunId :: !(Id WorkflowRun) @@ -50,22 +39,10 @@ data WorkflowRun = WorkflowRun , workflowRunAttempt :: !Integer , workflowRunStartedAt :: !UTCTime , workflowRunTrigerringActor :: !SimpleUser - , workflowRunRepository :: !Repo } deriving (Show, Data, Typeable, Eq, Ord, Generic) data RunAttempt = RunAttempt - -- { - -- jobId :: !(Id Job) - -- , runRunId :: !(Id WorkflowRun) - -- , workflowPath :: !Text - -- , workflowState :: !Text - -- , workflowCreatedAt :: !UTCTime - -- , workflowUpdatedAt :: !UTCTime - -- , workflowUrl :: !UTCTime - -- , workflowHtmlUrl :: !UTCTime - -- , workflowBadgeUrl :: !UTCTime - -- } deriving (Show, Data, Typeable, Eq, Ord, Generic) data ReviewHistory = ReviewHistory @@ -75,109 +52,6 @@ data ReviewHistory = ReviewHistory } deriving (Show, Data, Typeable, Eq, Ord, Generic) --- data RunCommit = RunCommit --- { --- runCommitId :: !Text --- , runCommitTreeId :: !Text --- } --- deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- instance NFData RunCommit where rnf = genericRnf --- instance Binary RunCommit - - --- data ActionWorkflowRun = ActionWorkflowRun --- { --- actionWorkflowRunId :: !(Id ActionWorkflowRun) --- , actionWorkflowRunHeadBranch :: !Text --- , actionWorkflowRunHeadSha :: !Text --- , actionWorkflowRunStatus :: !Text --- , actionWorkflowRunUrl :: !URL --- , actionWorkflowRunHtmlUrl :: !URL --- , actionWorkflowRunCreatedAt :: !UTCTime --- , actionWorkflowRunUpdatedAt :: !UTCTime --- -- , actionWorkflowRunRepo :: !Repo --- , actionWorkflowRunHeadCommit :: !RunCommit --- , actionWorkflowRunConclusion :: !(Maybe Text) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- data ActionWorkflowResult entity = ActionWorkflowResult --- { --- actionWorkflowTotalCount :: !Int --- , actionWorkflowResults :: !(Vector entity) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - - --- data ActionWorkflowRunResult entity = ActionWorkflowRunResult --- { --- actionWorkflowRunResultTotalCount :: !Int --- , actionWorkflowRunResultResults :: !(Vector entity) --- } deriving (Show, Data, Typeable, Eq, Ord, Generic) - --- data CreateWorkflowDispatchEvent a --- = CreateWorkflowDispatchEvent --- { createWorkflowDispatchEventRef :: !Text --- , createWorkflowDispatchEventInputs :: !a --- } --- deriving (Show, Generic) - --- instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf --- instance (Binary a) => Binary (CreateWorkflowDispatchEvent a) - --- ------------------------------------------------------------------------------- --- -- JSON instances --- ------------------------------------------------------------------------------- - --- instance FromJSON Workflow where --- parseJSON = withObject "Workflow" $ \o -> Workflow --- <$> o .: "id" --- <*> o .: "name" --- <*> o .: "path" --- <*> o .: "state" --- <*> o .: "created_at" --- <*> o .: "updated_at" --- <*> o .: "url" --- <*> o .: "html_url" --- <*> o .: "badge_url" - --- instance FromJSON (WithTotalCount Workflow) where --- parseJSON = withObject "WorkflowList" $ \o -> WithTotalCount --- <$> o .: "workflows" --- <*> o .: "total_count" - --- -- instance FromJSON a => FromJSON (ActionWorkflowResult a) where --- -- parseJSON = withObject "ActionWorkflowResult" $ \o -> ActionWorkflowResult --- -- <$> o .: "total_count" --- -- <*> o .:? "workflows" .!= V.empty - --- -- instance FromJSON a => FromJSON (ActionWorkflowRunResult a) where --- -- parseJSON = withObject "ActionWorkflowRunResult" $ \o -> ActionWorkflowRunResult --- -- <$> o .: "total_count" --- -- <*> o .:? "workflow_runs" .!= V.empty - --- -- instance FromJSON RunCommit where --- -- parseJSON = withObject "RunCommit" $ \o -> RunCommit --- -- <$> o .: "id" --- -- <*> o .: "tree_id" - --- -- instance FromJSON ActionWorkflowRun where --- -- parseJSON = withObject "ActionWorkflowRun" $ \o -> ActionWorkflowRun --- -- <$> o .: "id" --- -- <*> o .: "head_branch" --- -- <*> o .: "head_sha" --- -- <*> o .: "status" --- -- <*> o .: "url" --- -- <*> o .: "html_url" --- -- <*> o .: "created_at" --- -- <*> o .: "updated_at" --- -- -- <*> o .: "repository" --- -- <*> o .: "head_commit" --- -- <*> o .:? "conclusion" - - --- instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where --- toJSON (CreateWorkflowDispatchEvent ref inputs) = --- object [ "ref" .= ref, "inputs" .= inputs ] instance FromJSON WorkflowRun where parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun @@ -198,7 +72,17 @@ instance FromJSON WorkflowRun where <*> o .: "created_at" <*> o .: "updated_at" <*> o .: "actor" - <*> o .: "attempt" - <*> o .: "started_at" - <*> o .: "trigerring_actor" - <*> o .: "repository" + <*> o .: "run_attempt" + <*> o .: "run_started_at" + <*> o .: "triggering_actor" + +instance FromJSON (WithTotalCount WorkflowRun) where + parseJSON = withObject "WorkflowRunList" $ \o -> WithTotalCount + <$> o .: "workflow_runs" + <*> o .: "total_count" + +instance FromJSON ReviewHistory where + parseJSON = withObject "ReviewHistory" $ \o -> ReviewHistory + <$> o .: "state" + <*> o .: "comment" + <*> o .: "user" \ No newline at end of file diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index 068e0312..0a1ff455 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -9,6 +9,7 @@ module GitHub.Data.Actions.Workflows ( import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () @@ -21,9 +22,9 @@ data Workflow = Workflow , workflowState :: !Text , workflowCreatedAt :: !UTCTime , workflowUpdatedAt :: !UTCTime - , workflowUrl :: !UTCTime - , workflowHtmlUrl :: !UTCTime - , workflowBadgeUrl :: !UTCTime + , workflowUrl :: !URL + , workflowHtmlUrl :: !URL + , workflowBadgeUrl :: !URL } deriving (Show, Data, Typeable, Eq, Ord, Generic) diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 67b0518b..282ca786 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -65,6 +65,15 @@ module GitHub.Data.Options ( sortByCreatedAt, sortByLastAccessedAt, sortBySizeInBytes, + -- * Actions workflow runs + WorkflowRunMod, + workflowRunModToQueryString, + optionsWorkflowRunActor, + optionsWorkflowRunBranch, + optionsWorkflowRunEvent, + optionsWorkflowRunStatus, + optionsWorkflowRunCreated, + optionsWorkflowRunHeadSha, -- * Data IssueState (..), MergeableState (..), @@ -811,3 +820,92 @@ sortByLastAccessedAt = CacheMod $ \opts -> sortBySizeInBytes :: CacheMod sortBySizeInBytes = CacheMod $ \opts -> opts { cacheOptionsSort = Just SortCacheSizeInBytes } + +------------------------------------------------------------------------------- +-- Actions workflow runs +------------------------------------------------------------------------------- + +-- | See . +data WorkflowRunOptions = WorkflowRunOptions + { workflowRunOptionsActor :: !(Maybe Text) + , workflowRunOptionsBranch :: !(Maybe Text) + , workflowRunOptionsEvent :: !(Maybe Text) + , workflowRunOptionsStatus :: !(Maybe Text) + , workflowRunOptionsCreated :: !(Maybe Text) + , workflowRunOptionsHeadSha :: !(Maybe Text) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultWorkflowRunOptions :: WorkflowRunOptions +defaultWorkflowRunOptions = WorkflowRunOptions + { workflowRunOptionsActor = Nothing + , workflowRunOptionsBranch = Nothing + , workflowRunOptionsEvent = Nothing + , workflowRunOptionsStatus = Nothing + , workflowRunOptionsCreated = Nothing + , workflowRunOptionsHeadSha = Nothing + } + +-- | See . +newtype WorkflowRunMod = WorkflowRunMod (WorkflowRunOptions -> WorkflowRunOptions) + +instance Semigroup WorkflowRunMod where + WorkflowRunMod f <> WorkflowRunMod g = WorkflowRunMod (g . f) + +instance Monoid WorkflowRunMod where + mempty = WorkflowRunMod id + mappend = (<>) + +toWorkflowRunOptions :: WorkflowRunMod -> WorkflowRunOptions +toWorkflowRunOptions (WorkflowRunMod f) = f defaultWorkflowRunOptions + +workflowRunModToQueryString :: WorkflowRunMod -> QueryString +workflowRunModToQueryString = workflowRunOptionsToQueryString . toWorkflowRunOptions + +workflowRunOptionsToQueryString :: WorkflowRunOptions -> QueryString +workflowRunOptionsToQueryString (WorkflowRunOptions actor branch event status created headSha) = + catMaybes + [ mk "actor" <$> actor' + , mk "branch" <$> branch' + , mk "event" <$> event' + , mk "status" <$> status' + , mk "created" <$> created' + , mk "head_sha" <$> headSha' + ] + where + mk k v = (k, Just v) + actor' = fmap TE.encodeUtf8 actor + branch' = fmap TE.encodeUtf8 branch + event' = fmap TE.encodeUtf8 event + status' = fmap TE.encodeUtf8 status + created' = fmap TE.encodeUtf8 created + headSha' = fmap TE.encodeUtf8 headSha + +------------------------------------------------------------------------------- +-- Workflow run modifiers +------------------------------------------------------------------------------- + +optionsWorkflowRunActor :: Text -> WorkflowRunMod +optionsWorkflowRunActor x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsActor = Just x } + +optionsWorkflowRunBranch :: Text -> WorkflowRunMod +optionsWorkflowRunBranch x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsBranch = Just x } + +optionsWorkflowRunEvent :: Text -> WorkflowRunMod +optionsWorkflowRunEvent x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsEvent = Just x } + +optionsWorkflowRunStatus :: Text -> WorkflowRunMod +optionsWorkflowRunStatus x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsStatus = Just x } + +optionsWorkflowRunCreated :: Text -> WorkflowRunMod +optionsWorkflowRunCreated x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsCreated = Just x } + +optionsWorkflowRunHeadSha :: Text -> WorkflowRunMod +optionsWorkflowRunHeadSha x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsHeadSha = Just x } \ No newline at end of file diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs index d6b8e13f..4d571d52 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -33,7 +33,7 @@ import Prelude () reRunJobR :: Name Owner -> Name Repo - -> Id Job -> GenRequest 'MtJSON 'RW () + -> Id Job -> GenRequest 'MtUnit 'RW () reRunJobR user repo job = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"] mempty @@ -43,10 +43,11 @@ reRunJobR user repo job = Command Post workflowRunsR :: Name Owner -> Name Repo + -> WorkflowRunMod -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunsR user repo = PagedQuery +workflowRunsR user repo runMod = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "runs"] - [] + (workflowRunModToQueryString runMod) -- | Get a workflow run. -- See @@ -54,7 +55,7 @@ workflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) + -> GenRequest 'MtJSON 'RA WorkflowRun workflowRunR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] [] @@ -65,7 +66,7 @@ deleteWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RW () + -> GenRequest 'MtUnit 'RW () deleteWorkflowRunR user repo run = Command Delete ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] mempty @@ -87,7 +88,7 @@ approveWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RW () + -> GenRequest 'MtUnit 'RW () approveWorkflowRunR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approve"] mempty @@ -99,7 +100,7 @@ workflowRunAttemptR -> Name Repo -> Id WorkflowRun -> Id RunAttempt - -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) + -> GenRequest 'MtJSON 'RA WorkflowRun workflowRunAttemptR user repo run attempt = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt] [] @@ -122,7 +123,7 @@ cancelWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RW () + -> GenRequest 'MtUnit 'RW () cancelWorkflowRunR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "cancel"] mempty @@ -133,7 +134,7 @@ downloadWorkflowRunLogsR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtRedirect 'RO URI + -> GenRequest 'MtRedirect 'RA URI downloadWorkflowRunLogsR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] [] @@ -144,7 +145,7 @@ deleteWorkflowRunLogsR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RW () + -> GenRequest 'MtUnit 'RW () deleteWorkflowRunLogsR user repo run = Command Delete ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] mempty @@ -154,7 +155,7 @@ deleteWorkflowRunLogsR user repo run = Command Delete reRunWorkflowR :: Name Owner -> Name Repo - -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () + -> Id WorkflowRun-> GenRequest 'MtUnit 'RW () reRunWorkflowR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"] mempty @@ -164,7 +165,7 @@ reRunWorkflowR user repo run = Command Post reRunFailedJobsR :: Name Owner -> Name Repo - -> Id WorkflowRun-> GenRequest 'MtJSON 'RW () + -> Id WorkflowRun-> GenRequest 'MtUnit 'RW () reRunFailedJobsR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"] mempty @@ -175,7 +176,8 @@ workflowRunsForWorkflowR :: Name Owner -> Name Repo -> Id Workflow + -> WorkflowRunMod -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunsForWorkflowR user repo workflow = PagedQuery +workflowRunsForWorkflowR user repo workflow runMod = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "runs"] - [] + (workflowRunModToQueryString runMod) diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 72781666..624c9c5a 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -46,8 +46,8 @@ disableWorkflowR :: Name Owner -> Name Repo -> Id Workflow - -> GenRequest 'MtJSON 'RW Workflow -disableWorkflowR user repo workflow = command Put + -> GenRequest 'MtUnit 'RW () +disableWorkflowR user repo workflow = Command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "disable"] mempty @@ -58,8 +58,8 @@ triggerWorkflowR -> Name Repo -> Id Workflow -> CreateWorkflowDispatchEvent a - -> GenRequest 'MtJSON 'RW Workflow -triggerWorkflowR user repo workflow = command Post + -> GenRequest 'MtUnit 'RW () +triggerWorkflowR user repo workflow = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "dispatches"] . encode @@ -69,7 +69,7 @@ enableWorkflowR :: Name Owner -> Name Repo -> Id Workflow - -> GenRequest 'MtJSON 'RW Workflow -enableWorkflowR user repo workflow = command Put + -> GenRequest 'MtUnit 'RW () +enableWorkflowR user repo workflow = Command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "enable"] mempty From 1012da2f06a2702cbeac0b99365349e821895bcd Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 21:50:54 -0800 Subject: [PATCH 16/34] Format. --- spec/GitHub/Actions/CacheSpec.hs | 11 +++++------ spec/GitHub/Actions/SecretsSpec.hs | 13 ++++++------- spec/GitHub/Actions/WorkflowJobSpec.hs | 15 +++++++-------- spec/GitHub/Actions/WorkflowRunsSpec.hs | 13 ++++++------- spec/GitHub/Actions/WorkflowSpec.hs | 13 ++++++------- src/GitHub/Data/Actions/Secrets.hs | 2 +- src/GitHub/Data/Actions/WorkflowRuns.hs | 6 +++--- src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 2 +- 8 files changed, 35 insertions(+), 40 deletions(-) diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs index 07905d9c..c70596c3 100644 --- a/spec/GitHub/Actions/CacheSpec.hs +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -7,12 +7,11 @@ import qualified GitHub as GH import Prelude () import Prelude.Compat -import Data.Aeson (eitherDecodeStrict) -import Data.ByteString (ByteString) -import Data.FileEmbed (embedFile) -import qualified Data.Vector as V -import Test.Hspec - (Spec, describe, it, shouldBe) +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs index d0df9fa5..e9e32fa0 100644 --- a/spec/GitHub/Actions/SecretsSpec.hs +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -7,12 +7,11 @@ import qualified GitHub as GH import Prelude () import Prelude.Compat -import Data.Aeson (eitherDecodeStrict) -import Data.ByteString (ByteString) -import Data.FileEmbed (embedFile) -import qualified Data.Vector as V -import Test.Hspec - (Spec, describe, it, shouldBe) +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -48,4 +47,4 @@ spec = do orgSecretListPayload = $(embedFile "fixtures/actions/org-secrets-list.json") orgPublicKeyPayload :: ByteString - orgPublicKeyPayload = $(embedFile "fixtures/actions/org-public-key.json") \ No newline at end of file + orgPublicKeyPayload = $(embedFile "fixtures/actions/org-public-key.json") diff --git a/spec/GitHub/Actions/WorkflowJobSpec.hs b/spec/GitHub/Actions/WorkflowJobSpec.hs index 8cc9a4e2..43334741 100644 --- a/spec/GitHub/Actions/WorkflowJobSpec.hs +++ b/spec/GitHub/Actions/WorkflowJobSpec.hs @@ -2,17 +2,16 @@ {-# LANGUAGE TemplateHaskell #-} module GitHub.Actions.WorkflowJobSpec where -import qualified GitHub as GH -import GitHub.Data.Id +import qualified GitHub as GH +import GitHub.Data.Id import Prelude () import Prelude.Compat -import Data.Aeson (eitherDecodeStrict) -import Data.ByteString (ByteString) -import Data.FileEmbed (embedFile) -import Test.Hspec - (Spec, describe, it, shouldBe) +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import Test.Hspec (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -30,4 +29,4 @@ spec = do fromRightS (eitherDecodeStrict workflowJobPayload) workflowJobPayload :: ByteString - workflowJobPayload = $(embedFile "fixtures/actions/workflow-job.json") \ No newline at end of file + workflowJobPayload = $(embedFile "fixtures/actions/workflow-job.json") diff --git a/spec/GitHub/Actions/WorkflowRunsSpec.hs b/spec/GitHub/Actions/WorkflowRunsSpec.hs index 8e3d668a..0a5643c9 100644 --- a/spec/GitHub/Actions/WorkflowRunsSpec.hs +++ b/spec/GitHub/Actions/WorkflowRunsSpec.hs @@ -7,12 +7,11 @@ import qualified GitHub as GH import Prelude () import Prelude.Compat -import Data.Aeson (eitherDecodeStrict) -import Data.ByteString (ByteString) -import qualified Data.Vector as V -import Data.FileEmbed (embedFile) -import Test.Hspec - (Spec, describe, it, shouldBe) +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -30,4 +29,4 @@ spec = do fromRightS (eitherDecodeStrict workflowRunsPayload) workflowRunsPayload :: ByteString - workflowRunsPayload = $(embedFile "fixtures/actions/workflow-runs-list.json") \ No newline at end of file + workflowRunsPayload = $(embedFile "fixtures/actions/workflow-runs-list.json") diff --git a/spec/GitHub/Actions/WorkflowSpec.hs b/spec/GitHub/Actions/WorkflowSpec.hs index fffa8839..71c2aaad 100644 --- a/spec/GitHub/Actions/WorkflowSpec.hs +++ b/spec/GitHub/Actions/WorkflowSpec.hs @@ -7,12 +7,11 @@ import qualified GitHub as GH import Prelude () import Prelude.Compat -import Data.Aeson (eitherDecodeStrict) -import Data.ByteString (ByteString) -import qualified Data.Vector as V -import Data.FileEmbed (embedFile) -import Test.Hspec - (Spec, describe, it, shouldBe) +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -30,4 +29,4 @@ spec = do fromRightS (eitherDecodeStrict workflowPayload) workflowPayload :: ByteString - workflowPayload = $(embedFile "fixtures/actions/workflow-list.json") \ No newline at end of file + workflowPayload = $(embedFile "fixtures/actions/workflow-list.json") diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index e97d5397..81aa7492 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -143,4 +143,4 @@ instance FromJSON RepoSecret where instance FromJSON (WithTotalCount RepoSecret) where parseJSON = withObject "RepoSecretList" $ \o -> WithTotalCount <$> o .: "secrets" - <*> o .: "total_count" \ No newline at end of file + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 553179ea..979e5e7f 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -10,13 +10,13 @@ module GitHub.Data.Actions.WorkflowRuns ( import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Definitions +import GitHub.Data.PullRequests (SimplePullRequest) import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () -import GitHub.Data.PullRequests (SimplePullRequest) +import GitHub.Data.Id (Id) import GitHub.Data.Name (Name) -import GitHub.Data.Id (Id) data WorkflowRun = WorkflowRun { workflowRunWorkflowRunId :: !(Id WorkflowRun) @@ -85,4 +85,4 @@ instance FromJSON ReviewHistory where parseJSON = withObject "ReviewHistory" $ \o -> ReviewHistory <$> o .: "state" <*> o .: "comment" - <*> o .: "user" \ No newline at end of file + <*> o .: "user" diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs index fda2a6d8..31f11f7b 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -14,7 +14,7 @@ module GitHub.Endpoints.Actions.WorkflowJobs ( ) where import GitHub.Data -import Network.URI (URI) +import Network.URI (URI) import Prelude () -- | Get a job for a workflow run. From 3f83775ff176feef091544d3e04d61685795c19d Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 21:59:23 -0800 Subject: [PATCH 17/34] Drop slack-related files. --- hie.yaml | 6 ----- stack.yaml | 71 ------------------------------------------------- stack.yaml.lock | 19 ------------- 3 files changed, 96 deletions(-) delete mode 100644 hie.yaml delete mode 100644 stack.yaml delete mode 100644 stack.yaml.lock diff --git a/hie.yaml b/hie.yaml deleted file mode 100644 index 7ed87dfe..00000000 --- a/hie.yaml +++ /dev/null @@ -1,6 +0,0 @@ -cradle: - stack: - - path: "./src" - component: "github:lib" - - path: "./spec" - component: "github-test" diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 104a40a0..00000000 --- a/stack.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# This file was automatically generated by 'stack init' -# -# Some commonly used options have been documented as comments in this file. -# For advanced use and comprehensive documentation of the format, please see: -# https://docs.haskellstack.org/en/stable/yaml_configuration/ - -# Resolver to choose a 'specific' stackage snapshot or a compiler version. -# A snapshot resolver dictates the compiler version and the set of packages -# to be used for project dependencies. For example: -# -resolver: lts-16.27 -# resolver: nightly-2015-09-21 -# resolver: ghc-7.10.2 -# -# The location of a snapshot can be provided as a file or url. Stack assumes -# a snapshot provided as a file might change, whereas a url resource does not. -# -# resolver: ./custom-snapshot.yaml -# resolver: https://example.com/snapshots/2018-01-01.yaml -#resolver: -# url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/17/2.yaml - -# User packages to be built. -# Various formats can be used as shown in the example below. -# -# packages: -# - some-directory -# - https://example.com/foo/bar/baz-0.0.2.tar.gz -# subdirs: -# - auto-update -# - wai -packages: -- . -# Dependency packages to be pulled from upstream that are not in the resolver. -# These entries can reference officially published versions as well as -# forks / in-progress versions pinned to a git hash. For example: -# -# extra-deps: -# - acme-missiles-0.3 -# - git: https://github.com/commercialhaskell/stack.git -# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# -extra-deps: - - binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 - - -# Override default flag values for local packages and extra-deps -# flags: {} - -# Extra package databases containing global packages -# extra-package-dbs: [] - -# Control whether we use the GHC we find on the path -# system-ghc: true -# -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: ">=2.5" -# -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 -# -# Extra directories used by stack for building -# extra-include-dirs: [/path/to/dir] -# extra-lib-dirs: [/path/to/dir] -# -# Allow a newer minor version of GHC than the snapshot specifies -# compiler-check: newer-minor -ghc-options: - '$everything': -haddock diff --git a/stack.yaml.lock b/stack.yaml.lock deleted file mode 100644 index 6b754f14..00000000 --- a/stack.yaml.lock +++ /dev/null @@ -1,19 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - hackage: binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 - pantry-tree: - size: 1035 - sha256: 05d4c1e47e9550160fd0ebc97de6d5c2ed5b70afdf3aebf79b111bfe52f09b83 - original: - hackage: binary-instances-1.0.1@sha256:56bb2da1268415901d6ea3f46535b88b89459d7926fbfcca027e25e069ea6f2b,2647 -snapshots: -- completed: - size: 533252 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/27.yaml - sha256: c2aaae52beeacf6a5727c1010f50e89d03869abfab6d2c2658ade9da8ed50c73 - original: lts-16.27 From 7212468acaeebe25feba980ca8d12a11c189edf5 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Sun, 20 Nov 2022 22:10:14 -0800 Subject: [PATCH 18/34] Format JSON --- fixtures/actions/artifact.json | 35 +- fixtures/actions/cache-list.json | 25 +- fixtures/actions/org-cache-usage.json | 4 +- fixtures/actions/org-public-key.json | 5 +- fixtures/actions/org-secrets-list.json | 33 +- fixtures/actions/repo-cache-usage.json | 7 +- .../selected-repositories-for-secret.json | 141 +- fixtures/actions/workflow-job.json | 224 +-- fixtures/actions/workflow-list.json | 32 +- fixtures/actions/workflow-runs-list.json | 1291 ++++++++--------- 10 files changed, 889 insertions(+), 908 deletions(-) diff --git a/fixtures/actions/artifact.json b/fixtures/actions/artifact.json index 5d8076b7..cb06b454 100644 --- a/fixtures/actions/artifact.json +++ b/fixtures/actions/artifact.json @@ -1,20 +1,19 @@ { - "id": 416767789, - "node_id": "MDg6QXJ0aWZhY3Q0MTY3Njc3ODk=", - "name": "dist-without-markdown", - "size_in_bytes": 42718, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789", - "archive_download_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789/zip", - "expired": false, - "created_at": "2022-10-29T22:18:21Z", - "updated_at": "2022-10-29T22:18:23Z", - "expires_at": "2023-01-27T22:18:16Z", - "workflow_run": { - "id": 3353148947, - "repository_id": 559365297, - "head_repository_id": 559365297, - "head_branch": "main", - "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954" - } + "id": 416767789, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3Njc3ODk=", + "name": "dist-without-markdown", + "size_in_bytes": 42718, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789", + "archive_download_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789/zip", + "expired": false, + "created_at": "2022-10-29T22:18:21Z", + "updated_at": "2022-10-29T22:18:23Z", + "expires_at": "2023-01-27T22:18:16Z", + "workflow_run": { + "id": 3353148947, + "repository_id": 559365297, + "head_repository_id": 559365297, + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954" } - \ No newline at end of file +} diff --git a/fixtures/actions/cache-list.json b/fixtures/actions/cache-list.json index 7e0cf3a6..64cf3956 100644 --- a/fixtures/actions/cache-list.json +++ b/fixtures/actions/cache-list.json @@ -1,15 +1,14 @@ { - "total_count": 1, - "actions_caches": [ - { - "id": 1, - "ref": "refs/heads/main", - "key": "cache_key", - "version": "f5f850afdadd47730296d4ffa900de95f6bbafb75dc1e8475df1fa6ae79dcece", - "last_accessed_at": "2022-10-30T00:08:14.223333300Z", - "created_at": "2022-10-30T00:08:14.223333300Z", - "size_in_bytes": 26586 - } - ] + "total_count": 1, + "actions_caches": [ + { + "id": 1, + "ref": "refs/heads/main", + "key": "cache_key", + "version": "f5f850afdadd47730296d4ffa900de95f6bbafb75dc1e8475df1fa6ae79dcece", + "last_accessed_at": "2022-10-30T00:08:14.223333300Z", + "created_at": "2022-10-30T00:08:14.223333300Z", + "size_in_bytes": 26586 + } + ] } - \ No newline at end of file diff --git a/fixtures/actions/org-cache-usage.json b/fixtures/actions/org-cache-usage.json index c1822137..99be4def 100644 --- a/fixtures/actions/org-cache-usage.json +++ b/fixtures/actions/org-cache-usage.json @@ -1,4 +1,4 @@ { - "total_active_caches_size_in_bytes": 26586, - "total_active_caches_count": 1 + "total_active_caches_size_in_bytes": 26586, + "total_active_caches_count": 1 } diff --git a/fixtures/actions/org-public-key.json b/fixtures/actions/org-public-key.json index 7624898e..621c84eb 100644 --- a/fixtures/actions/org-public-key.json +++ b/fixtures/actions/org-public-key.json @@ -1,5 +1,4 @@ { - "key_id": "568250167242549743", - "key": "KHVvOxB765kjkShEgUu27QCzl5XxKz/L20V+KRsWf0w=" + "key_id": "568250167242549743", + "key": "KHVvOxB765kjkShEgUu27QCzl5XxKz/L20V+KRsWf0w=" } - \ No newline at end of file diff --git a/fixtures/actions/org-secrets-list.json b/fixtures/actions/org-secrets-list.json index 5e1e079f..241a8737 100644 --- a/fixtures/actions/org-secrets-list.json +++ b/fixtures/actions/org-secrets-list.json @@ -1,19 +1,18 @@ { - "total_count": 2, - "secrets": [ - { - "name": "TEST_SECRET", - "created_at": "2022-10-31T00:08:12Z", - "updated_at": "2022-10-31T00:08:12Z", - "visibility": "all" - }, - { - "name": "TEST_SELECTED", - "created_at": "2022-10-31T00:08:43Z", - "updated_at": "2022-10-31T00:08:43Z", - "visibility": "selected", - "selected_repositories_url": "https://api.github.com/orgs/kote-test-org-actions/actions/secrets/TEST_SELECTED/repositories" - } - ] + "total_count": 2, + "secrets": [ + { + "name": "TEST_SECRET", + "created_at": "2022-10-31T00:08:12Z", + "updated_at": "2022-10-31T00:08:12Z", + "visibility": "all" + }, + { + "name": "TEST_SELECTED", + "created_at": "2022-10-31T00:08:43Z", + "updated_at": "2022-10-31T00:08:43Z", + "visibility": "selected", + "selected_repositories_url": "https://api.github.com/orgs/kote-test-org-actions/actions/secrets/TEST_SELECTED/repositories" + } + ] } - \ No newline at end of file diff --git a/fixtures/actions/repo-cache-usage.json b/fixtures/actions/repo-cache-usage.json index d5194b49..bf8659be 100644 --- a/fixtures/actions/repo-cache-usage.json +++ b/fixtures/actions/repo-cache-usage.json @@ -1,6 +1,5 @@ { - "full_name": "python/cpython", - "active_caches_size_in_bytes": 55000268087, - "active_caches_count": 171 + "full_name": "python/cpython", + "active_caches_size_in_bytes": 55000268087, + "active_caches_count": 171 } - \ No newline at end of file diff --git a/fixtures/actions/selected-repositories-for-secret.json b/fixtures/actions/selected-repositories-for-secret.json index 815dd413..71ce3d35 100644 --- a/fixtures/actions/selected-repositories-for-secret.json +++ b/fixtures/actions/selected-repositories-for-secret.json @@ -1,73 +1,72 @@ { - "total_count": 1, - "repositories": [ - { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" - } - ] + "total_count": 1, + "repositories": [ + { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + ] } - \ No newline at end of file diff --git a/fixtures/actions/workflow-job.json b/fixtures/actions/workflow-job.json index f9548006..e8e35d0f 100644 --- a/fixtures/actions/workflow-job.json +++ b/fixtures/actions/workflow-job.json @@ -1,113 +1,113 @@ { - "id": 9183275828, - "run_id": 3353449941, - "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", - "run_attempt": 1, - "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", - "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", - "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", - "status": "completed", - "conclusion": "success", - "started_at": "2022-10-30T00:09:29Z", - "completed_at": "2022-10-30T00:09:49Z", - "name": "check-bats-version", - "steps": [ - { - "name": "Set up job", - "status": "completed", - "conclusion": "success", - "number": 1, - "started_at": "2022-10-29T17:09:29.000-07:00", - "completed_at": "2022-10-29T17:09:32.000-07:00" - }, - { - "name": "Run actions/checkout@v3", - "status": "completed", - "conclusion": "success", - "number": 2, - "started_at": "2022-10-29T17:09:32.000-07:00", - "completed_at": "2022-10-29T17:09:33.000-07:00" - }, - { - "name": "Run actions/setup-node@v3", - "status": "completed", - "conclusion": "success", - "number": 3, - "started_at": "2022-10-29T17:09:34.000-07:00", - "completed_at": "2022-10-29T17:09:39.000-07:00" - }, - { - "name": "Run npm install -g bats", - "status": "completed", - "conclusion": "success", - "number": 4, - "started_at": "2022-10-29T17:09:40.000-07:00", - "completed_at": "2022-10-29T17:09:42.000-07:00" - }, - { - "name": "Run bats -v", - "status": "completed", - "conclusion": "success", - "number": 5, - "started_at": "2022-10-29T17:09:42.000-07:00", - "completed_at": "2022-10-29T17:09:42.000-07:00" - }, - { - "name": "Archive Test", - "status": "completed", - "conclusion": "success", - "number": 6, - "started_at": "2022-10-29T17:09:42.000-07:00", - "completed_at": "2022-10-29T17:09:46.000-07:00" - }, - { - "name": "Cache", - "status": "completed", - "conclusion": "success", - "number": 7, - "started_at": "2022-10-29T17:09:46.000-07:00", - "completed_at": "2022-10-29T17:09:47.000-07:00" - }, - { - "name": "Post Cache", - "status": "completed", - "conclusion": "success", - "number": 12, - "started_at": "2022-10-29T17:09:49.000-07:00", - "completed_at": "2022-10-29T17:09:47.000-07:00" - }, - { - "name": "Post Run actions/setup-node@v3", - "status": "completed", - "conclusion": "success", - "number": 13, - "started_at": "2022-10-29T17:09:49.000-07:00", - "completed_at": "2022-10-29T17:09:49.000-07:00" - }, - { - "name": "Post Run actions/checkout@v3", - "status": "completed", - "conclusion": "success", - "number": 14, - "started_at": "2022-10-29T17:09:49.000-07:00", - "completed_at": "2022-10-29T17:09:49.000-07:00" - }, - { - "name": "Complete job", - "status": "completed", - "conclusion": "success", - "number": 15, - "started_at": "2022-10-29T17:09:47.000-07:00", - "completed_at": "2022-10-29T17:09:47.000-07:00" - } - ], - "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", - "labels": [ - "ubuntu-latest" - ], - "runner_id": 1, - "runner_name": "Hosted Agent", - "runner_group_id": 2, - "runner_group_name": "GitHub Actions" - } \ No newline at end of file + "id": 9183275828, + "run_id": 3353449941, + "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "run_attempt": 1, + "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", + "status": "completed", + "conclusion": "success", + "started_at": "2022-10-30T00:09:29Z", + "completed_at": "2022-10-30T00:09:49Z", + "name": "check-bats-version", + "steps": [ + { + "name": "Set up job", + "status": "completed", + "conclusion": "success", + "number": 1, + "started_at": "2022-10-29T17:09:29.000-07:00", + "completed_at": "2022-10-29T17:09:32.000-07:00" + }, + { + "name": "Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 2, + "started_at": "2022-10-29T17:09:32.000-07:00", + "completed_at": "2022-10-29T17:09:33.000-07:00" + }, + { + "name": "Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 3, + "started_at": "2022-10-29T17:09:34.000-07:00", + "completed_at": "2022-10-29T17:09:39.000-07:00" + }, + { + "name": "Run npm install -g bats", + "status": "completed", + "conclusion": "success", + "number": 4, + "started_at": "2022-10-29T17:09:40.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Run bats -v", + "status": "completed", + "conclusion": "success", + "number": 5, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Archive Test", + "status": "completed", + "conclusion": "success", + "number": 6, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:46.000-07:00" + }, + { + "name": "Cache", + "status": "completed", + "conclusion": "success", + "number": 7, + "started_at": "2022-10-29T17:09:46.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Cache", + "status": "completed", + "conclusion": "success", + "number": 12, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 13, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Post Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 14, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Complete job", + "status": "completed", + "conclusion": "success", + "number": 15, + "started_at": "2022-10-29T17:09:47.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + } + ], + "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", + "labels": [ + "ubuntu-latest" + ], + "runner_id": 1, + "runner_name": "Hosted Agent", + "runner_group_id": 2, + "runner_group_name": "GitHub Actions" +} diff --git a/fixtures/actions/workflow-list.json b/fixtures/actions/workflow-list.json index d4abfadf..771dcd87 100644 --- a/fixtures/actions/workflow-list.json +++ b/fixtures/actions/workflow-list.json @@ -1,17 +1,17 @@ { - "total_count": 1, - "workflows": [ - { - "id": 39065091, - "node_id": "W_kwDOIVc8sc4CVBYD", - "name": "learn-github-actions", - "path": ".github/workflows/make_artifact.yaml", - "state": "active", - "created_at": "2022-10-29T15:17:59.000-07:00", - "updated_at": "2022-10-29T15:17:59.000-07:00", - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", - "html_url": "https://github.com/kote-test-org-actions/actions-api/blob/main/.github/workflows/make_artifact.yaml", - "badge_url": "https://github.com/kote-test-org-actions/actions-api/workflows/learn-github-actions/badge.svg" - } - ] -} \ No newline at end of file + "total_count": 1, + "workflows": [ + { + "id": 39065091, + "node_id": "W_kwDOIVc8sc4CVBYD", + "name": "learn-github-actions", + "path": ".github/workflows/make_artifact.yaml", + "state": "active", + "created_at": "2022-10-29T15:17:59.000-07:00", + "updated_at": "2022-10-29T15:17:59.000-07:00", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "html_url": "https://github.com/kote-test-org-actions/actions-api/blob/main/.github/workflows/make_artifact.yaml", + "badge_url": "https://github.com/kote-test-org-actions/actions-api/workflows/learn-github-actions/badge.svg" + } + ] +} diff --git a/fixtures/actions/workflow-runs-list.json b/fixtures/actions/workflow-runs-list.json index 28f51b33..edaf5c59 100644 --- a/fixtures/actions/workflow-runs-list.json +++ b/fixtures/actions/workflow-runs-list.json @@ -1,678 +1,665 @@ { - "total_count": 3, - "workflow_runs": [ - { - "id": 3353449941, - "name": "K0Te is learning GitHub Actions", - "node_id": "WFR_kwLOIVc8sc7H4ZXV", - "head_branch": "main", - "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", - "path": ".github/workflows/make_artifact.yaml", - "display_title": "K0Te is learning GitHub Actions", - "run_number": 3, - "event": "push", - "status": "completed", - "conclusion": "success", - "workflow_id": 39065091, - "check_suite_id": 9030268154, - "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj70-g", - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", - "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941", - "pull_requests": [ - - ], - "created_at": "2022-10-30T00:09:22Z", - "updated_at": "2022-10-30T00:09:50Z", - "actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "total_count": 3, + "workflow_runs": [ + { + "id": 3353449941, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4ZXV", + "head_branch": "main", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 3, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030268154, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj70-g", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941", + "pull_requests": [], + "created_at": "2022-10-30T00:09:22Z", + "updated_at": "2022-10-30T00:09:50Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-30T00:09:22Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030268154", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "3156f684232a3adec5085c920d2006aca80f2798", + "tree_id": "f51ba8632086ca7af92f5e58c1dc98df1c62d7ce", + "message": "up", + "timestamp": "2022-10-30T00:09:16Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "run_attempt": 1, - "referenced_workflows": [ - - ], - "run_started_at": "2022-10-30T00:09:22Z", - "triggering_actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs", - "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/logs", - "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030268154", - "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/artifacts", - "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/cancel", - "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/rerun", - "previous_attempt_url": null, - "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", - "head_commit": { - "id": "3156f684232a3adec5085c920d2006aca80f2798", - "tree_id": "f51ba8632086ca7af92f5e58c1dc98df1c62d7ce", - "message": "up", - "timestamp": "2022-10-30T00:09:16Z", - "author": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - }, - "committer": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - } - }, - "repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353445625, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4YT5", + "head_branch": "main", + "head_sha": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 2, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030259685, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj7T5Q", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353445625", + "pull_requests": [], + "created_at": "2022-10-30T00:07:49Z", + "updated_at": "2022-10-30T00:08:19Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-30T00:07:49Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030259685", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "tree_id": "21d858674ab650ea734b7efbf05442a21685d121", + "message": "up", + "timestamp": "2022-10-30T00:07:44Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" }, - "head_repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" } }, - { - "id": 3353445625, - "name": "K0Te is learning GitHub Actions", - "node_id": "WFR_kwLOIVc8sc7H4YT5", - "head_branch": "main", - "head_sha": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", - "path": ".github/workflows/make_artifact.yaml", - "display_title": "K0Te is learning GitHub Actions", - "run_number": 2, - "event": "push", - "status": "completed", - "conclusion": "success", - "workflow_id": 39065091, - "check_suite_id": 9030259685, - "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj7T5Q", - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625", - "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353445625", - "pull_requests": [ - - ], - "created_at": "2022-10-30T00:07:49Z", - "updated_at": "2022-10-30T00:08:19Z", - "actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "run_attempt": 1, - "referenced_workflows": [ - - ], - "run_started_at": "2022-10-30T00:07:49Z", - "triggering_actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/jobs", - "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/logs", - "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030259685", - "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/artifacts", - "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/cancel", - "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/rerun", - "previous_attempt_url": null, - "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", - "head_commit": { - "id": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", - "tree_id": "21d858674ab650ea734b7efbf05442a21685d121", - "message": "up", - "timestamp": "2022-10-30T00:07:44Z", - "author": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - }, - "committer": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - } - }, - "repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353148947, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H3P4T", + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 1, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9029740591, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGjboLw", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353148947", + "pull_requests": [], + "created_at": "2022-10-29T22:18:02Z", + "updated_at": "2022-10-29T22:18:22Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-29T22:18:02Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9029740591", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "tree_id": "7aa2d4e6f4e0ddb277fe2f35f7615651ee01c5a2", + "message": "test", + "timestamp": "2022-10-29T22:17:55Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" }, - "head_repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" } }, - { - "id": 3353148947, - "name": "K0Te is learning GitHub Actions", - "node_id": "WFR_kwLOIVc8sc7H3P4T", - "head_branch": "main", - "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954", - "path": ".github/workflows/make_artifact.yaml", - "display_title": "K0Te is learning GitHub Actions", - "run_number": 1, - "event": "push", - "status": "completed", - "conclusion": "success", - "workflow_id": 39065091, - "check_suite_id": 9029740591, - "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGjboLw", - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947", - "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353148947", - "pull_requests": [ - - ], - "created_at": "2022-10-29T22:18:02Z", - "updated_at": "2022-10-29T22:18:22Z", - "actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "run_attempt": 1, - "referenced_workflows": [ - - ], - "run_started_at": "2022-10-29T22:18:02Z", - "triggering_actor": { - "login": "K0Te", - "id": 6162155, - "node_id": "MDQ6VXNlcjYxNjIxNTU=", - "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/K0Te", - "html_url": "https://github.com/K0Te", - "followers_url": "https://api.github.com/users/K0Te/followers", - "following_url": "https://api.github.com/users/K0Te/following{/other_user}", - "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", - "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", - "organizations_url": "https://api.github.com/users/K0Te/orgs", - "repos_url": "https://api.github.com/users/K0Te/repos", - "events_url": "https://api.github.com/users/K0Te/events{/privacy}", - "received_events_url": "https://api.github.com/users/K0Te/received_events", - "type": "User", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", "site_admin": false }, - "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/jobs", - "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/logs", - "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9029740591", - "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/artifacts", - "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/cancel", - "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/rerun", - "previous_attempt_url": null, - "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", - "head_commit": { - "id": "601593ecb1d8a57a04700fdb445a28d4186b8954", - "tree_id": "7aa2d4e6f4e0ddb277fe2f35f7615651ee01c5a2", - "message": "test", - "timestamp": "2022-10-29T22:17:55Z", - "author": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - }, - "committer": { - "name": "Oleg Nykolyn", - "email": "juravel2@gmail.com" - } - }, - "repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" - }, - "head_repository": { - "id": 559365297, - "node_id": "R_kgDOIVc8sQ", - "name": "actions-api", - "full_name": "kote-test-org-actions/actions-api", - "private": true, - "owner": { - "login": "kote-test-org-actions", - "id": 116976977, - "node_id": "O_kgDOBvjtUQ", - "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kote-test-org-actions", - "html_url": "https://github.com/kote-test-org-actions", - "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", - "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", - "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", - "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", - "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", - "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", - "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/kote-test-org-actions/actions-api", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", - "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", - "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", - "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", - "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", - "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", - "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", - "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", - "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", - "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", - "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", - "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", - "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", - "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", - "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", - "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", - "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", - "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", - "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", - "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", - "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", - "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", - "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", - "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" - } + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" } - ] - } - \ No newline at end of file + } + ] +} From 72acb6232e9ca799e8b9f4dc2012ce590c8b9fd3 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Mon, 28 Nov 2022 15:35:28 -0800 Subject: [PATCH 19/34] Support workflow name in workflowRunsForWorkflowR. --- src/GitHub/Endpoints/Actions/Cache.hs | 20 +++- src/GitHub/Endpoints/Actions/Secrets.hs | 109 +++++++++++++++---- src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 27 ++++- src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 33 +++--- 4 files changed, 148 insertions(+), 41 deletions(-) diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs index e58639a7..3ab79368 100644 --- a/src/GitHub/Endpoints/Actions/Cache.hs +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -20,19 +20,27 @@ import Prelude () -- | Get Actions cache usage for the organization. -- See -cacheUsageOrganizationR :: Name Organization -> GenRequest 'MtJSON 'RA OrganizationCacheUsage +cacheUsageOrganizationR + :: Name Organization + -> GenRequest 'MtJSON 'RA OrganizationCacheUsage cacheUsageOrganizationR org = Query ["orgs", toPathPart org, "actions", "cache", "usage"] [] -- | List repositories with GitHub Actions cache usage for an organization. -- See -cacheUsageByRepositoryR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) +cacheUsageByRepositoryR + :: Name Organization + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) cacheUsageByRepositoryR org = PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] [] -- | Get GitHub Actions cache usage for a repository. -- See -cacheUsageR :: Name Owner -> Name Repo -> Request k RepositoryCacheUsage +cacheUsageR + :: Name Owner + -> Name Repo + -> Request k RepositoryCacheUsage cacheUsageR user repo = Query ["repos", toPathPart user, toPathPart repo, "actions", "cache", "usage"] [] @@ -50,7 +58,11 @@ cachesForRepoR user repo opts = PagedQuery -- | Delete GitHub Actions cache for a repository. -- See -deleteCacheR :: Name Owner -> Name Repo -> Id Cache -> GenRequest 'MtUnit 'RW () +deleteCacheR + :: Name Owner + -> Name Repo + -> Id Cache + -> GenRequest 'MtUnit 'RW () deleteCacheR user repo cacheid = Command Delete parts mempty where diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs index f67942de..c2d481e1 100644 --- a/src/GitHub/Endpoints/Actions/Secrets.hs +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -34,31 +34,46 @@ import Prelude () -- | List organization secrets. -- See -organizationSecretsR :: Name Organization -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) +organizationSecretsR + :: Name Organization + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) organizationSecretsR org = PagedQuery ["orgs", toPathPart org, "actions", "secrets"] [] -- | List organization secrets. -- See -organizationPublicKeyR :: Name Organization -> GenRequest 'MtJSON 'RA PublicKey +organizationPublicKeyR + :: Name Organization + -> GenRequest 'MtJSON 'RA PublicKey organizationPublicKeyR org = Query ["orgs", toPathPart org, "actions", "secrets", "public-key"] [] -- | Get an organization secret. -- See -organizationSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtJSON 'RA OrganizationSecret +organizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> GenRequest 'MtJSON 'RA OrganizationSecret organizationSecretR org name = Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name] [] -- | Create or update an organization secret. -- See -setOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> SetSecret -> GenRequest 'MtUnit 'RW () +setOrganizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> SetSecret + -> GenRequest 'MtUnit 'RW () setOrganizationSecretR org name = Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete an organization secret. -- See -deleteOrganizationSecretR :: Name Organization -> Name OrganizationSecret -> GenRequest 'MtUnit 'RW () +deleteOrganizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> GenRequest 'MtUnit 'RW () deleteOrganizationSecretR org name = Command Delete parts mempty where @@ -66,55 +81,91 @@ deleteOrganizationSecretR org name = -- | Get selected repositories for an organization secret. -- See -organizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) +organizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) organizationSelectedRepositoriesForSecretR org name = PagedQuery ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] -- | Set selected repositories for an organization secret. -- See -setOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> SetSelectedRepositories -> GenRequest 'MtUnit 'RW () +setOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> SetSelectedRepositories + -> GenRequest 'MtUnit 'RW () setOrganizationSelectedRepositoriesForSecretR org name = Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode -- | Add selected repository to an organization secret. -- See -addOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtUnit 'RW () +addOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> Id Repo + -> GenRequest 'MtUnit 'RW () addOrganizationSelectedRepositoriesForSecretR org name repo = Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty -- | Remove selected repository from an organization secret. -- See -removeOrganizationSelectedRepositoriesForSecretR :: Name Organization -> Name OrganizationSecret -> Id Repo -> GenRequest 'MtUnit 'RW () +removeOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> Id Repo + -> GenRequest 'MtUnit 'RW () removeOrganizationSelectedRepositoriesForSecretR org name repo = Command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty -- | List repository secrets. -- See -repoSecretsR :: Name Owner -> Name Repo -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +repoSecretsR + :: Name Owner + -> Name Repo + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) repoSecretsR user repo = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "secrets"] [] -- | Get a repository public key. -- See -repoPublicKeyR :: Name Owner -> Name Organization -> GenRequest 'MtJSON 'RA PublicKey +repoPublicKeyR + :: Name Owner + -> Name Organization + -> GenRequest 'MtJSON 'RA PublicKey repoPublicKeyR user org = Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", "public-key"] [] -- | Get a repository secret. -- See -repoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> GenRequest 'MtJSON 'RA RepoSecret +repoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> GenRequest 'MtJSON 'RA RepoSecret repoSecretR user org name = Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] [] -- | Create or update a repository secret. -- See -setRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> SetRepoSecret -> GenRequest 'MtUnit 'RW () +setRepoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> SetRepoSecret + -> GenRequest 'MtUnit 'RW () setRepoSecretR user org name = Command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode -- | Delete a repository secret. -- See -deleteRepoSecretR :: Name Owner -> Name Organization -> Name RepoSecret -> GenRequest 'MtUnit 'RW () +deleteRepoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> GenRequest 'MtUnit 'RW () deleteRepoSecretR user org name = Command Delete parts mempty where @@ -122,31 +173,51 @@ deleteRepoSecretR user org name = -- | List environment secrets. -- See -environmentSecretsR :: Id Repo -> Name Environment -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +environmentSecretsR + :: Id Repo + -> Name Environment + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) environmentSecretsR repo env = PagedQuery ["repositories", toPathPart repo, "environments", toPathPart env, "secrets"] [] -- | Get an environment public key. -- See -environmentPublicKeyR :: Id Repo -> Name Environment -> GenRequest 'MtJSON 'RA PublicKey +environmentPublicKeyR + :: Id Repo + -> Name Environment + -> GenRequest 'MtJSON 'RA PublicKey environmentPublicKeyR repo env = Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", "public-key"] [] -- | Get an environment secret -- See -environmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> GenRequest 'MtJSON 'RA RepoSecret +environmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> GenRequest 'MtJSON 'RA RepoSecret environmentSecretR repo env name = Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] [] -- | Create or update an environment secret. -- See -setEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> SetRepoSecret -> GenRequest 'MtUnit 'RW () +setEnvironmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> SetRepoSecret + -> GenRequest 'MtUnit 'RW () setEnvironmentSecretR repo env name = Command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode -- | Delete an environment secret. -- See -deleteEnvironmentSecretR :: Id Repo -> Name Environment -> Name RepoSecret -> GenRequest 'MtUnit 'RW () +deleteEnvironmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> GenRequest 'MtUnit 'RW () deleteEnvironmentSecretR repo env name = Command Delete parts mempty where diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs index 31f11f7b..d9c91096 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -19,24 +19,43 @@ import Prelude () -- | Get a job for a workflow run. -- See -jobR :: Name Owner -> Name Repo -> Id Job -> Request 'RA Job +jobR + :: Name Owner + -> Name Repo + -> Id Job + -> Request 'RA Job jobR owner repo job = Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job] [] -- | Download job logs for a workflow run. -- See -downloadJobLogsR :: Name Owner -> Name Repo -> Id Job -> GenRequest 'MtRedirect 'RO URI +downloadJobLogsR + :: Name Owner + -> Name Repo + -> Id Job + -> GenRequest 'MtRedirect 'RO URI downloadJobLogsR owner repo job = Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job, "logs"] [] -- | List jobs for a workflow run attempt. -- See -jobsForWorkflowRunAttemptR :: Name Owner -> Name Repo -> Id WorkflowRun -> Id RunAttempt -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunAttemptR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Job) jobsForWorkflowRunAttemptR owner repo run attempt = PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "jobs"] [] -- | List jobs for a workflow run. -- See -jobsForWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Job) jobsForWorkflowRunR owner repo run = PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] [] diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs index 4d571d52..85438c19 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -33,7 +33,8 @@ import Prelude () reRunJobR :: Name Owner -> Name Repo - -> Id Job -> GenRequest 'MtUnit 'RW () + -> Id Job + -> GenRequest 'MtUnit 'RW () reRunJobR user repo job = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"] mempty @@ -44,7 +45,8 @@ workflowRunsR :: Name Owner -> Name Repo -> WorkflowRunMod - -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) workflowRunsR user repo runMod = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "runs"] (workflowRunModToQueryString runMod) @@ -55,7 +57,7 @@ workflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RA WorkflowRun + -> GenRequest 'MtJSON 'RA WorkflowRun workflowRunR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] [] @@ -66,7 +68,7 @@ deleteWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtUnit 'RW () + -> GenRequest 'MtUnit 'RW () deleteWorkflowRunR user repo run = Command Delete ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] mempty @@ -77,7 +79,7 @@ workflowRunReviewHistoryR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtJSON 'RA (Vector ReviewHistory) + -> GenRequest 'MtJSON 'RA (Vector ReviewHistory) workflowRunReviewHistoryR user repo run = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approvals"] [] @@ -88,7 +90,7 @@ approveWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtUnit 'RW () + -> GenRequest 'MtUnit 'RW () approveWorkflowRunR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approve"] mempty @@ -100,7 +102,7 @@ workflowRunAttemptR -> Name Repo -> Id WorkflowRun -> Id RunAttempt - -> GenRequest 'MtJSON 'RA WorkflowRun + -> GenRequest 'MtJSON 'RA WorkflowRun workflowRunAttemptR user repo run attempt = Query ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt] [] @@ -123,7 +125,7 @@ cancelWorkflowRunR :: Name Owner -> Name Repo -> Id WorkflowRun - -> GenRequest 'MtUnit 'RW () + -> GenRequest 'MtUnit 'RW () cancelWorkflowRunR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "cancel"] mempty @@ -155,7 +157,8 @@ deleteWorkflowRunLogsR user repo run = Command Delete reRunWorkflowR :: Name Owner -> Name Repo - -> Id WorkflowRun-> GenRequest 'MtUnit 'RW () + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () reRunWorkflowR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"] mempty @@ -165,7 +168,8 @@ reRunWorkflowR user repo run = Command Post reRunFailedJobsR :: Name Owner -> Name Repo - -> Id WorkflowRun-> GenRequest 'MtUnit 'RW () + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () reRunFailedJobsR user repo run = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"] mempty @@ -173,11 +177,12 @@ reRunFailedJobsR user repo run = Command Post -- | List workflow runs for a workflow. -- See workflowRunsForWorkflowR - :: Name Owner + :: (IsPathPart idOrName) => Name Owner -> Name Repo - -> Id Workflow + -> idOrFileName -> WorkflowRunMod - -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) workflowRunsForWorkflowR user repo workflow runMod = PagedQuery - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "runs"] + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrFileName, "runs"] (workflowRunModToQueryString runMod) From c329f88cda8d977411545dbba5a87449bfbe1d3e Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Mon, 28 Nov 2022 15:38:12 -0800 Subject: [PATCH 20/34] Support workflow name in Workflows.hs. --- src/GitHub/Endpoints/Actions/Workflows.hs | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 624c9c5a..71d0b128 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -32,44 +32,44 @@ repositoryWorkflowsR user repo = PagedQuery -- | Get a workflow. -- See workflowR - :: Name Owner + :: (IsPathPart idOrName) => Name Owner -> Name Repo - -> Id Workflow + -> idOrName -> GenRequest 'MtJSON 'RA Workflow -workflowR user repo workflow = Query - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow] +workflowR user repo idOrName = Query + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName] [] -- | Disable a workflow. -- See disableWorkflowR - :: Name Owner + :: (IsPathPart idOrName) => Name Owner -> Name Repo - -> Id Workflow + -> idOrName -> GenRequest 'MtUnit 'RW () disableWorkflowR user repo workflow = Command Put - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "disable"] + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "disable"] mempty -- | Create a workflow dispatch event. -- See triggerWorkflowR - :: (ToJSON a) => Name Owner + :: (ToJSON a, IsPathPart idOrName) => Name Owner -> Name Repo - -> Id Workflow + -> idOrName -> CreateWorkflowDispatchEvent a -> GenRequest 'MtUnit 'RW () triggerWorkflowR user repo workflow = Command Post - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "dispatches"] + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "dispatches"] . encode -- | Enable a workflow. -- See enableWorkflowR - :: Name Owner + :: (IsPathPart idOrName) => Name Owner -> Name Repo - -> Id Workflow + -> idOrName -> GenRequest 'MtUnit 'RW () enableWorkflowR user repo workflow = Command Put - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart workflow, "enable"] + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "enable"] mempty From 42418cc650b832b4a39a665cd35387f44604e0f4 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Mon, 28 Nov 2022 15:50:38 -0800 Subject: [PATCH 21/34] Fix --- src/GitHub/Endpoints/Actions/Workflows.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 71d0b128..6b150751 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -47,7 +47,7 @@ disableWorkflowR -> Name Repo -> idOrName -> GenRequest 'MtUnit 'RW () -disableWorkflowR user repo workflow = Command Put +disableWorkflowR user repo idOrName = Command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "disable"] mempty @@ -59,7 +59,7 @@ triggerWorkflowR -> idOrName -> CreateWorkflowDispatchEvent a -> GenRequest 'MtUnit 'RW () -triggerWorkflowR user repo workflow = Command Post +triggerWorkflowR user repo idOrName = Command Post ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "dispatches"] . encode @@ -70,6 +70,6 @@ enableWorkflowR -> Name Repo -> idOrName -> GenRequest 'MtUnit 'RW () -enableWorkflowR user repo workflow = Command Put +enableWorkflowR user repo idOrName = Command Put ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "enable"] mempty From 7d7ea3c3c0247459b6cbc9eb443c667c90d2508f Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Mon, 28 Nov 2022 15:59:57 -0800 Subject: [PATCH 22/34] Fix --- src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs index 85438c19..ebe8dccc 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -179,10 +179,10 @@ reRunFailedJobsR user repo run = Command Post workflowRunsForWorkflowR :: (IsPathPart idOrName) => Name Owner -> Name Repo - -> idOrFileName + -> idOrName -> WorkflowRunMod -> FetchCount -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) -workflowRunsForWorkflowR user repo workflow runMod = PagedQuery - ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrFileName, "runs"] +workflowRunsForWorkflowR user repo idOrName runMod = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "runs"] (workflowRunModToQueryString runMod) From c6833bf43441318d08d8fcac455818e312694912 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Wed, 30 Nov 2022 11:27:27 -0800 Subject: [PATCH 23/34] Do not parse pull requests from workflow runs. --- src/GitHub/Data/Actions/WorkflowRuns.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 979e5e7f..303f260a 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -10,7 +10,6 @@ module GitHub.Data.Actions.WorkflowRuns ( import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Definitions -import GitHub.Data.PullRequests (SimplePullRequest) import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () @@ -32,7 +31,6 @@ data WorkflowRun = WorkflowRun , workflowRunWorkflowId :: !Integer , workflowRunUrl :: !URL , workflowRunHtmlUrl :: !URL - , workflowRunPullRequests :: !(Vector SimplePullRequest) , workflowRunCreatedAt :: !UTCTime , workflowRunUpdatedAt :: !UTCTime , workflowRunActor :: !SimpleUser @@ -68,7 +66,6 @@ instance FromJSON WorkflowRun where <*> o .: "workflow_id" <*> o .: "url" <*> o .: "html_url" - <*> o .: "pull_requests" <*> o .: "created_at" <*> o .: "updated_at" <*> o .: "actor" From 4c995da0eba23bf2e74c57ac70b11e2681609c71 Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Wed, 30 Nov 2022 12:08:07 -0800 Subject: [PATCH 24/34] Avoid parsing 'trigerring_actor', it is sometimes missing. --- src/GitHub/Data/Actions/WorkflowRuns.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 303f260a..c2ae6243 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -36,7 +36,6 @@ data WorkflowRun = WorkflowRun , workflowRunActor :: !SimpleUser , workflowRunAttempt :: !Integer , workflowRunStartedAt :: !UTCTime - , workflowRunTrigerringActor :: !SimpleUser } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -71,7 +70,6 @@ instance FromJSON WorkflowRun where <*> o .: "actor" <*> o .: "run_attempt" <*> o .: "run_started_at" - <*> o .: "triggering_actor" instance FromJSON (WithTotalCount WorkflowRun) where parseJSON = withObject "WorkflowRunList" $ \o -> WithTotalCount From 7838a81c0f607e299664e034a983cd611bfda08f Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Wed, 30 Nov 2022 12:38:16 -0800 Subject: [PATCH 25/34] Fix workflow run conclusion parsing. --- src/GitHub/Data/Actions/WorkflowRuns.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index c2ae6243..74db411c 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -27,7 +27,7 @@ data WorkflowRun = WorkflowRun , workflowRunRunNumber :: !Integer , workflowRunEvent :: !Text , workflowRunStatus :: !Text - , workflowRunConclusion :: !Text + , workflowRunConclusion :: !(Maybe Text) , workflowRunWorkflowId :: !Integer , workflowRunUrl :: !URL , workflowRunHtmlUrl :: !URL From a24393c149da9aa2a25669781119468f904d470c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 16:40:21 +0200 Subject: [PATCH 26/34] Whitespace and lexical changes only --- src/GitHub/Data/Actions/Artifacts.hs | 31 ++++++++++++----------- src/GitHub/Data/Actions/Cache.hs | 26 +++++++++---------- src/GitHub/Data/Actions/Common.hs | 10 ++++---- src/GitHub/Data/Options.hs | 4 +-- src/GitHub/Endpoints/Actions/Workflows.hs | 1 + 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index fba3c577..1a9ea277 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -6,6 +6,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} + module GitHub.Data.Actions.Artifacts ( Artifact(..), ArtifactWorkflowRun(..), @@ -20,31 +21,31 @@ import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) import GitHub.Data.Repos (Repo) - ------------------------------------------------------------------------------- -- Artifact ------------------------------------------------------------------------------- + data ArtifactWorkflowRun = ArtifactWorkflowRun - { artifactWorkflowRunWorkflowRunId :: !(Id WorkflowRun) - , artifactWorkflowRunRepositoryId :: !(Id Repo) + { artifactWorkflowRunWorkflowRunId :: !(Id WorkflowRun) + , artifactWorkflowRunRepositoryId :: !(Id Repo) , artifactWorkflowRunHeadRepositoryId :: !(Id Repo) - , artifactWorkflowRunHeadBranch :: !Text - , artifactWorkflowRunHeadSha :: !Text + , artifactWorkflowRunHeadBranch :: !Text + , artifactWorkflowRunHeadSha :: !Text } deriving (Show, Data, Typeable, Eq, Ord, Generic) data Artifact = Artifact { artifactArchiveDownloadUrl :: !URL - , artifactCreatedAt :: !UTCTime - , artifactExpired :: !Bool - , artifactExpiresAt :: !UTCTime - , artifactId :: !(Id Artifact) - , artifactName :: !Text - , artifactNodeId :: !Text - , artifactSizeInBytes :: !Int - , artifactUpdatedAt :: !UTCTime - , artifactUrl :: !URL - , artifactWorkflowRun :: !ArtifactWorkflowRun + , artifactCreatedAt :: !UTCTime + , artifactExpired :: !Bool + , artifactExpiresAt :: !UTCTime + , artifactId :: !(Id Artifact) + , artifactName :: !Text + , artifactNodeId :: !Text + , artifactSizeInBytes :: !Int + , artifactUpdatedAt :: !UTCTime + , artifactUrl :: !URL + , artifactWorkflowRun :: !ArtifactWorkflowRun } deriving (Show, Data, Typeable, Eq, Ord, Generic) diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs index 83ad52fc..49ce0485 100644 --- a/src/GitHub/Data/Actions/Cache.hs +++ b/src/GitHub/Data/Actions/Cache.hs @@ -24,27 +24,27 @@ import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) ------------------------------------------------------------------------------- data Cache = Cache - { cacheId :: !(Id Cache) - , cacheRef :: !Text - , cacheKey :: !Text - , cacheVersion :: !Text + { cacheId :: !(Id Cache) + , cacheRef :: !Text + , cacheKey :: !Text + , cacheVersion :: !Text , cacheLastAccessedAt :: !UTCTime - , cacheCreatedAt :: !UTCTime - , cacheSizeInBytes :: !Int + , cacheCreatedAt :: !UTCTime + , cacheSizeInBytes :: !Int } deriving (Show, Data, Typeable, Eq, Ord, Generic) data RepositoryCacheUsage = RepositoryCacheUsage - { repositoryCacheUsageFullName :: !Text - , repositoryCacheUsageActiveCachesSizeInBytes :: !Int - , repositoryCacheUsageActiveCachesCount :: !Int - } + { repositoryCacheUsageFullName :: !Text + , repositoryCacheUsageActiveCachesSizeInBytes :: !Int + , repositoryCacheUsageActiveCachesCount :: !Int + } deriving (Show, Data, Typeable, Eq, Ord, Generic) data OrganizationCacheUsage = OrganizationCacheUsage - { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int - , organizationCacheUsageTotalActiveCachesCount :: !Int - } + { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int + , organizationCacheUsageTotalActiveCachesCount :: !Int + } deriving (Show, Data, Typeable, Eq, Ord, Generic) -- ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index 62d73c80..c256aa9e 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -6,26 +6,26 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} + module GitHub.Data.Actions.Common ( WithTotalCount(..), ) where - import GitHub.Internal.Prelude import Prelude () - ------------------------------------------------------------------------------- -- Common ------------------------------------------------------------------------------- data WithTotalCount a = WithTotalCount - { withTotalCountItems :: !(Vector a) + { withTotalCountItems :: !(Vector a) , withTotalCountTotalCount :: !Int - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) instance Semigroup (WithTotalCount a) where - (WithTotalCount items1 count1) <> (WithTotalCount items2 _) = + WithTotalCount items1 count1 <> WithTotalCount items2 _ = WithTotalCount (items1 <> items2) count1 instance Foldable WithTotalCount where diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index bdc2e035..f70ab61e 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -703,7 +703,7 @@ optionsNoAssignee = IssueRepoMod $ \opts -> optionsAssignee :: Name User -> IssueRepoMod optionsAssignee u = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterBy u } - + ------------------------------------------------------------------------------- -- Actions artifacts ------------------------------------------------------------------------------- @@ -933,4 +933,4 @@ optionsWorkflowRunCreated x = WorkflowRunMod $ \opts -> optionsWorkflowRunHeadSha :: Text -> WorkflowRunMod optionsWorkflowRunHeadSha x = WorkflowRunMod $ \opts -> - opts { workflowRunOptionsHeadSha = Just x } \ No newline at end of file + opts { workflowRunOptionsHeadSha = Just x } diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 6b150751..437e7d7a 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -5,6 +5,7 @@ -- -- -- -- The pull requests API as documented at -- -- . + module GitHub.Endpoints.Actions.Workflows ( repositoryWorkflowsR, workflowR, From c4ac51c035e6131c2d61940203b7d170014aef27 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 17:09:03 +0200 Subject: [PATCH 27/34] Remove outdated maintainer from module headers --- src/GitHub/Data/Actions/Artifacts.hs | 5 ----- src/GitHub/Data/Actions/Cache.hs | 7 +------ src/GitHub/Data/Actions/Common.hs | 5 ----- src/GitHub/Data/Actions/Secrets.hs | 6 +----- src/GitHub/Endpoints/Actions/Artifacts.hs | 5 +---- src/GitHub/Endpoints/Actions/Cache.hs | 5 +---- src/GitHub/Endpoints/Actions/Secrets.hs | 5 +---- src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 5 +---- src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 7 ------- src/GitHub/Endpoints/Actions/Workflows.hs | 8 -------- 10 files changed, 6 insertions(+), 52 deletions(-) diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index 1a9ea277..7b572d2b 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs index 49ce0485..74f7c086 100644 --- a/src/GitHub/Data/Actions/Cache.hs +++ b/src/GitHub/Data/Actions/Cache.hs @@ -1,11 +1,7 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} + module GitHub.Data.Actions.Cache ( Cache(..), RepositoryCacheUsage(..), @@ -18,7 +14,6 @@ import Prelude () import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) - ------------------------------------------------------------------------------- -- Cache ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index c256aa9e..86c6ae94 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index 81aa7492..f7822cac 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -1,12 +1,8 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RecordWildCards #-} + module GitHub.Data.Actions.Secrets ( OrganizationSecret(..), PublicKey(..), diff --git a/src/GitHub/Endpoints/Actions/Artifacts.hs b/src/GitHub/Endpoints/Actions/Artifacts.hs index b3cbb399..2bc30d8f 100644 --- a/src/GitHub/Endpoints/Actions/Artifacts.hs +++ b/src/GitHub/Endpoints/Actions/Artifacts.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The actions API as documented at -- . + module GitHub.Endpoints.Actions.Artifacts ( artifactsForR, artifactR, diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs index 3ab79368..fe085420 100644 --- a/src/GitHub/Endpoints/Actions/Cache.hs +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The actions API as documented at -- . + module GitHub.Endpoints.Actions.Cache ( cacheUsageOrganizationR, cacheUsageByRepositoryR, diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs index c2d481e1..c6b0d6b8 100644 --- a/src/GitHub/Endpoints/Actions/Secrets.hs +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The actions API as documented at -- . + module GitHub.Endpoints.Actions.Secrets ( organizationSecretsR, organizationPublicKeyR, diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs index d9c91096..881803b4 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The actions API as documented at -- . + module GitHub.Endpoints.Actions.WorkflowJobs ( jobR, downloadJobLogsR, diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs index ebe8dccc..3039323d 100644 --- a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -1,10 +1,3 @@ --- ----------------------------------------------------------------------------- --- -- | --- -- License : BSD-3-Clause --- -- Maintainer : Oleg Grenrus --- -- --- -- The pull requests API as documented at --- -- . module GitHub.Endpoints.Actions.WorkflowRuns ( reRunJobR, workflowRunsR, diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs index 437e7d7a..998a88b4 100644 --- a/src/GitHub/Endpoints/Actions/Workflows.hs +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -1,11 +1,3 @@ --- ----------------------------------------------------------------------------- --- -- | --- -- License : BSD-3-Clause --- -- Maintainer : Oleg Grenrus --- -- --- -- The pull requests API as documented at --- -- . - module GitHub.Endpoints.Actions.Workflows ( repositoryWorkflowsR, workflowR, From 21f2904e1bb7da6de07f3139297ab2fcf923b384 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 17:37:40 +0200 Subject: [PATCH 28/34] Whitespace: align code --- src/GitHub/Data/Actions/Cache.hs | 6 +-- src/GitHub/Data/Actions/Secrets.hs | 7 ++- src/GitHub/Data/Actions/WorkflowJobs.hs | 65 +++++++++++++------------ src/GitHub/Data/Actions/WorkflowRuns.hs | 8 +++ src/GitHub/Data/Actions/Workflows.hs | 34 ++++++------- src/GitHub/Data/Options.hs | 52 ++++++++++---------- 6 files changed, 89 insertions(+), 83 deletions(-) diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs index 74f7c086..a4f65a60 100644 --- a/src/GitHub/Data/Actions/Cache.hs +++ b/src/GitHub/Data/Actions/Cache.hs @@ -42,9 +42,9 @@ data OrganizationCacheUsage = OrganizationCacheUsage } deriving (Show, Data, Typeable, Eq, Ord, Generic) --- ------------------------------------------------------------------------------- --- -- JSON instances --- ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- instance FromJSON Cache where parseJSON = withObject "Cache" $ \o -> Cache diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index f7822cac..c734ad89 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -23,7 +23,6 @@ import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Name (Name) import GitHub.Data.Repos (Repo) - ------------------------------------------------------------------------------- -- Secret ------------------------------------------------------------------------------- @@ -78,9 +77,9 @@ data RepoSecret = RepoSecret data Environment = Environment deriving (Show, Data, Typeable, Eq, Ord, Generic) --- ------------------------------------------------------------------------------- --- -- JSON instances --- ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- instance FromJSON OrganizationSecret where parseJSON = withObject "Secret" $ \o -> OrganizationSecret diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs index b3524a10..9698e3a9 100644 --- a/src/GitHub/Data/Actions/WorkflowJobs.hs +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -7,55 +7,56 @@ module GitHub.Data.Actions.WorkflowJobs ( Job(..), ) where -import GitHub.Data.Id (Id) -import GitHub.Data.Name (Name) -import GitHub.Data.URL (URL) +import Prelude () import GitHub.Internal.Prelude (Applicative ((<*>)), Data, Eq, FromJSON (parseJSON), Generic, Integer, Ord, Show, Text, Typeable, UTCTime, Vector, withObject, ($), (.:), (<$>)) -import Prelude () + +import GitHub.Data.Id (Id) +import GitHub.Data.Name (Name) +import GitHub.Data.URL (URL) import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) +------------------------------------------------------------------------------- +-- Workflow jobs +------------------------------------------------------------------------------- data JobStep = JobStep - { - jobStepName :: !(Name JobStep) - , jobStepStatus :: !Text - , jobStepConclusion :: !Text - , jobStepNumber :: !Integer - , jobStepStartedAt :: !UTCTime - , jobStepCompletedAt :: !UTCTime + { jobStepName :: !(Name JobStep) + , jobStepStatus :: !Text + , jobStepConclusion :: !Text + , jobStepNumber :: !Integer + , jobStepStartedAt :: !UTCTime + , jobStepCompletedAt :: !UTCTime } deriving (Show, Data, Typeable, Eq, Ord, Generic) data Job = Job - { - jobId :: !(Id Job) - , jobRunId :: !(Id WorkflowRun) - , jobRunUrl :: !URL - , jobRunAttempt :: !Integer - , jobNodeId :: !Text - , jobHeadSha :: !Text - , jobUrl :: !URL - , jobHtmlUrl :: !URL - , jobStatus :: !Text - , jobConclusion :: !Text - , jobStartedAt :: !UTCTime - , jobCompletedAt :: !UTCTime - , jobSteps :: !(Vector JobStep) - , jobRunCheckUrl :: !URL - , jobLabels :: !(Vector Text) - , jobRunnerId :: !Integer - , jobRunnerName :: !Text - , jobRunnerGroupId :: !Integer - , jobRunnerGroupName :: !Text + { jobId :: !(Id Job) + , jobRunId :: !(Id WorkflowRun) + , jobRunUrl :: !URL + , jobRunAttempt :: !Integer + , jobNodeId :: !Text + , jobHeadSha :: !Text + , jobUrl :: !URL + , jobHtmlUrl :: !URL + , jobStatus :: !Text + , jobConclusion :: !Text + , jobStartedAt :: !UTCTime + , jobCompletedAt :: !UTCTime + , jobSteps :: !(Vector JobStep) + , jobRunCheckUrl :: !URL + , jobLabels :: !(Vector Text) + , jobRunnerId :: !Integer + , jobRunnerName :: !Text + , jobRunnerGroupId :: !Integer + , jobRunnerGroupName :: !Text } deriving (Show, Data, Typeable, Eq, Ord, Generic) - ------------------------------------------------------------------------------- -- JSON instances ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 74db411c..3dae581b 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -17,6 +17,10 @@ import Prelude () import GitHub.Data.Id (Id) import GitHub.Data.Name (Name) +------------------------------------------------------------------------------- +-- Workflow runs +------------------------------------------------------------------------------- + data WorkflowRun = WorkflowRun { workflowRunWorkflowRunId :: !(Id WorkflowRun) , workflowRunName :: !(Name WorkflowRun) @@ -50,6 +54,10 @@ data ReviewHistory = ReviewHistory } deriving (Show, Data, Typeable, Eq, Ord, Generic) +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + instance FromJSON WorkflowRun where parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun <$> o .: "id" diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index 0a1ff455..9dd2252d 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -7,32 +7,30 @@ module GitHub.Data.Actions.Workflows ( CreateWorkflowDispatchEvent(..), ) where +import Prelude () +import GitHub.Internal.Prelude + import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) import GitHub.Data.Id (Id) import GitHub.Data.URL (URL) -import GitHub.Internal.Prelude -import Prelude () - data Workflow = Workflow - { - workflowWorkflowId :: !(Id Workflow) - , workflowName :: !Text - , workflowPath :: !Text - , workflowState :: !Text - , workflowCreatedAt :: !UTCTime - , workflowUpdatedAt :: !UTCTime - , workflowUrl :: !URL - , workflowHtmlUrl :: !URL - , workflowBadgeUrl :: !URL + { workflowWorkflowId :: !(Id Workflow) + , workflowName :: !Text + , workflowPath :: !Text + , workflowState :: !Text + , workflowCreatedAt :: !UTCTime + , workflowUpdatedAt :: !UTCTime + , workflowUrl :: !URL + , workflowHtmlUrl :: !URL + , workflowBadgeUrl :: !URL } deriving (Show, Data, Typeable, Eq, Ord, Generic) -data CreateWorkflowDispatchEvent a - = CreateWorkflowDispatchEvent - { createWorkflowDispatchEventRef :: !Text - , createWorkflowDispatchEventInputs :: !a - } +data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent + { createWorkflowDispatchEventRef :: !Text + , createWorkflowDispatchEventInputs :: !a + } deriving (Show, Generic) instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 74993a7a..4d3a6db2 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -707,7 +707,7 @@ optionsAssignee u = IssueRepoMod $ \opts -> ------------------------------------------------------------------------------- -- | See . data ArtifactOptions = ArtifactOptions - { artifactOptionsName :: !(Maybe Text) + { artifactOptionsName :: !(Maybe Text) } deriving (Eq, Ord, Show, Generic, Typeable, Data) @@ -752,8 +752,8 @@ artifactOptionsToQueryString (ArtifactOptions name) = -- | See . data CacheOptions = CacheOptions - { cacheOptionsRef :: !(Maybe Text) - , cacheOptionsKey :: !(Maybe Text) + { cacheOptionsRef :: !(Maybe Text) + , cacheOptionsKey :: !(Maybe Text) , cacheOptionsSort :: !(Maybe SortCache) , cacheOptionsDirection :: !(Maybe SortDirection) } @@ -762,9 +762,9 @@ data CacheOptions = CacheOptions defaultCacheOptions :: CacheOptions defaultCacheOptions = CacheOptions - { cacheOptionsRef = Nothing - , cacheOptionsKey = Nothing - , cacheOptionsSort = Nothing + { cacheOptionsRef = Nothing + , cacheOptionsKey = Nothing + , cacheOptionsSort = Nothing , cacheOptionsDirection = Nothing } @@ -787,9 +787,9 @@ cacheModToQueryString = cacheOptionsToQueryString . toCacheOptions cacheOptionsToQueryString :: CacheOptions -> QueryString cacheOptionsToQueryString (CacheOptions ref key sort dir) = catMaybes - [ mk "ref" <$> ref' - , mk "key" <$> key' - , mk "sort" <$> sort' + [ mk "ref" <$> ref' + , mk "key" <$> key' + , mk "sort" <$> sort' , mk "directions" <$> direction' ] where @@ -850,10 +850,10 @@ sortBySizeInBytes = CacheMod $ \opts -> -- | See . data WorkflowRunOptions = WorkflowRunOptions - { workflowRunOptionsActor :: !(Maybe Text) - , workflowRunOptionsBranch :: !(Maybe Text) - , workflowRunOptionsEvent :: !(Maybe Text) - , workflowRunOptionsStatus :: !(Maybe Text) + { workflowRunOptionsActor :: !(Maybe Text) + , workflowRunOptionsBranch :: !(Maybe Text) + , workflowRunOptionsEvent :: !(Maybe Text) + , workflowRunOptionsStatus :: !(Maybe Text) , workflowRunOptionsCreated :: !(Maybe Text) , workflowRunOptionsHeadSha :: !(Maybe Text) } @@ -862,10 +862,10 @@ data WorkflowRunOptions = WorkflowRunOptions defaultWorkflowRunOptions :: WorkflowRunOptions defaultWorkflowRunOptions = WorkflowRunOptions - { workflowRunOptionsActor = Nothing - , workflowRunOptionsBranch = Nothing - , workflowRunOptionsEvent = Nothing - , workflowRunOptionsStatus = Nothing + { workflowRunOptionsActor = Nothing + , workflowRunOptionsBranch = Nothing + , workflowRunOptionsEvent = Nothing + , workflowRunOptionsStatus = Nothing , workflowRunOptionsCreated = Nothing , workflowRunOptionsHeadSha = Nothing } @@ -889,19 +889,19 @@ workflowRunModToQueryString = workflowRunOptionsToQueryString . toWorkflowRunOpt workflowRunOptionsToQueryString :: WorkflowRunOptions -> QueryString workflowRunOptionsToQueryString (WorkflowRunOptions actor branch event status created headSha) = catMaybes - [ mk "actor" <$> actor' - , mk "branch" <$> branch' - , mk "event" <$> event' - , mk "status" <$> status' - , mk "created" <$> created' + [ mk "actor" <$> actor' + , mk "branch" <$> branch' + , mk "event" <$> event' + , mk "status" <$> status' + , mk "created" <$> created' , mk "head_sha" <$> headSha' ] where mk k v = (k, Just v) - actor' = fmap TE.encodeUtf8 actor - branch' = fmap TE.encodeUtf8 branch - event' = fmap TE.encodeUtf8 event - status' = fmap TE.encodeUtf8 status + actor' = fmap TE.encodeUtf8 actor + branch' = fmap TE.encodeUtf8 branch + event' = fmap TE.encodeUtf8 event + status' = fmap TE.encodeUtf8 status created' = fmap TE.encodeUtf8 created headSha' = fmap TE.encodeUtf8 headSha From 9e2b1487536245f7885e39d32f66da28c7e1efda Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 17:59:43 +0200 Subject: [PATCH 29/34] Bump cabal-version to 2.4 for globbing --- github.cabal | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/github.cabal b/github.cabal index 4f0bc920..fda944ff 100644 --- a/github.cabal +++ b/github.cabal @@ -1,4 +1,4 @@ -cabal-version: >=1.10 +cabal-version: 2.4 name: github version: 0.29 synopsis: Access to the GitHub API, v3. @@ -20,7 +20,7 @@ description: . For more of an overview please see the README: -license: BSD3 +license: BSD-3-Clause license-file: LICENSE author: Mike Burns, John Wiegley, Oleg Grenrus maintainer: Andreas Abel @@ -43,10 +43,12 @@ tested-with: GHC == 7.10.3 GHC == 7.8.4 -extra-source-files: +extra-doc-files: README.md CHANGELOG.md - fixtures/*.json + +extra-source-files: + fixtures/**/*.json source-repository head type: git @@ -178,7 +180,8 @@ library GitHub.Internal.Prelude GitHub.Request - other-modules: Paths_github + other-modules: Paths_github + autogen-modules: Paths_github -- Packages bundles with GHC, mtl and text are also here build-depends: From 6b9d05e9928f66eff8cb1e665514615be2d371d0 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 18:00:45 +0200 Subject: [PATCH 30/34] Cosmetics: use (<&>) --- src/GitHub/Data/Options.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 4d3a6db2..39e2e3e4 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -794,13 +794,13 @@ cacheOptionsToQueryString (CacheOptions ref key sort dir) = ] where mk k v = (k, Just v) - sort' = fmap (\case - SortCacheCreatedAt -> "created_at" - SortCacheLastAccessedAt -> "last_accessed_at" - SortCacheSizeInBytes -> "size_in_bytes") sort - direction' = fmap (\case + sort' = sort <&> \case + SortCacheCreatedAt -> "created_at" + SortCacheLastAccessedAt -> "last_accessed_at" + SortCacheSizeInBytes -> "size_in_bytes" + direction' = dir <&> \case SortDescending -> "desc" - SortAscending -> "asc") dir + SortAscending -> "asc" ref' = fmap TE.encodeUtf8 ref key' = fmap TE.encodeUtf8 key From 6a03ecc88d13944ab0466a6c1e84e382a2d4b2ad Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 18:02:31 +0200 Subject: [PATCH 31/34] Restore upper bounds for openssl etc. in .cabal file --- github.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github.cabal b/github.cabal index fda944ff..5f94c430 100644 --- a/github.cabal +++ b/github.cabal @@ -217,9 +217,9 @@ library if flag(openssl) build-depends: - HsOpenSSL >=0.11.4.16 && <1.12 - , HsOpenSSL-x509-system >=0.1.0.3 && <1.2 - , http-client-openssl >=0.2.2.0 && <1.4 + HsOpenSSL >=0.11.4.16 && <0.12 + , HsOpenSSL-x509-system >=0.1.0.3 && <0.2 + , http-client-openssl >=0.2.2.0 && <0.4 else build-depends: From 2a4ddc0b1e6971ebfdd50d8b826972bd645898e5 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 18:07:52 +0200 Subject: [PATCH 32/34] Whitespace --- src/GitHub/Data/Options.hs | 2 ++ src/GitHub/Endpoints/Actions/Artifacts.hs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 39e2e3e4..f1ce58da 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -705,6 +705,7 @@ optionsAssignee u = IssueRepoMod $ \opts -> ------------------------------------------------------------------------------- -- Actions artifacts ------------------------------------------------------------------------------- + -- | See . data ArtifactOptions = ArtifactOptions { artifactOptionsName :: !(Maybe Text) @@ -746,6 +747,7 @@ artifactOptionsToQueryString (ArtifactOptions name) = where mk k v = (k, Just v) name' = fmap TE.encodeUtf8 name + ------------------------------------------------------------------------------- -- Actions cache ------------------------------------------------------------------------------- diff --git a/src/GitHub/Endpoints/Actions/Artifacts.hs b/src/GitHub/Endpoints/Actions/Artifacts.hs index 2bc30d8f..ac55dd61 100644 --- a/src/GitHub/Endpoints/Actions/Artifacts.hs +++ b/src/GitHub/Endpoints/Actions/Artifacts.hs @@ -28,7 +28,6 @@ artifactsForR user repo opts = PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] (artifactModToQueryString opts) - -- | Get an artifact. -- See artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request 'RA Artifact From 8efa8b6b19e4615d9855d8614d58d2a0746573af Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 24 Jun 2023 07:13:09 +0200 Subject: [PATCH 33/34] Add haddocks for WithTotalCount --- src/GitHub/Data/Actions/Common.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index 86c6ae94..ed02b6f0 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -13,12 +13,18 @@ import Prelude () -- Common ------------------------------------------------------------------------------- +-- | A page of a paginated response. data WithTotalCount a = WithTotalCount { withTotalCountItems :: !(Vector a) + -- ^ A snippet of the answer. , withTotalCountTotalCount :: !Int + -- ^ The total size of the answer. } deriving (Show, Data, Typeable, Eq, Ord, Generic) +-- | Joining two pages of a paginated response. +-- The 'withTotalCountTotalCount' is assumed to be the same in both pages, +-- but this is not checked. instance Semigroup (WithTotalCount a) where WithTotalCount items1 count1 <> WithTotalCount items2 _ = WithTotalCount (items1 <> items2) count1 From 9837d4cbef58e50621127e7bb3abe544a98c3080 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 24 Jun 2023 07:29:11 +0200 Subject: [PATCH 34/34] Changelog for PR #459 --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fa91d95..0926cfee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ ## Changes for 0.29 -_2022-06-24, Andreas Abel, Midsommar edition_ +_2023-06-24, Andreas Abel, Midsommar edition_ + +- Support for the GitHub Actions API + (PR [#459](https://github.com/haskell-github/github/pull/459)): + * New endpoint modules `GitHub.EndPoints.Actions.Artifacts`, `.Cache`, + `.Secrets`, `.Workflows`, `.WorkflowRuns`, `.WorkflowJobs`. + * Matching data structure modules `GitHub.Data.Actions.*`. - Add field `issueStateReason` of type `Maybe IssueStateReason` to `Issue` with possible values `completed`, `not_planned` and `reopened`