-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGitHubWorkflowRun.ps1
More file actions
136 lines (109 loc) · 4.4 KB
/
GitHubWorkflowRun.ps1
File metadata and controls
136 lines (109 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
class GitHubWorkflowRun : GitHubNode {
# The name of the workflow run.
# Example: "Build"
[string] $Name
# The name of the organization or user the variable is associated with.
# Example: "octocat"
[string] $Owner
# The name of the repository the variable is associated with.
# Example: "hello-world"
[string] $Repository
# The ID of the associated check suite.
# Example: 42
[System.Nullable[UInt64]] $CheckSuiteID
# The node ID of the associated check suite.
# Example: "MDEwOkNoZWNrU3VpdGU0Mg=="
[string] $CheckSuiteNodeID
# The branch name of the head commit.
# Example: "master"
[string] $HeadBranch
# The SHA of the head commit that points to the version of the workflow being run.
# Example: "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d"
[string] $HeadSha
# The full path of the workflow.
# Example: "octocat/octo-repo/.github/workflows/ci.yml@main"
[string] $Path
# The auto incrementing run number for the workflow run.
# Example: 106
[UInt64] $RunNumber
# Attempt number of the run, 1 for first attempt and higher if the workflow was re-run.
# Example: 1
[uint] $RunAttempt
# Array of referenced workflows.
# Example: (array of objects, nullable)
[PSCustomObject[]] $ReferencedWorkflows
# The event that triggered the workflow run.
# Example: "push"
[string] $Event
# The current status of the workflow run.
# Example: "completed"
[string] $Status
# The conclusion of the workflow run.
# Example: "neutral"
[string] $Conclusion
# The ID of the parent workflow.
# Example: 5
[UInt64] $WorkflowID
# The HTML URL to view the workflow run.
# Example: "https://github.com/github/hello-world/suites/4"
[string] $Url
# Pull requests associated with the workflow run.
# Example: (array of pull request objects, nullable)
[PSCustomObject[]] $PullRequests
# The creation timestamp of the workflow run.
# Example: "2023-01-01T12:00:00Z"
[System.Nullable[datetime]] $CreatedAt
# The last updated timestamp of the workflow run.
# Example: "2023-01-01T12:05:00Z"
[System.Nullable[datetime]] $UpdatedAt
# The user who triggered the workflow run.
# Example: (simple-user object)
[GitHubUser] $Actor
# The user who actually triggered the workflow run (may differ from Actor).
# Example: (simple-user object)
[GitHubUser] $TriggeringActor
# The start time of the latest run. Resets on re-run.
# Example: "2023-01-01T12:01:00Z"
[System.Nullable[datetime]] $StartedAt
# The head commit details.
# Example: (nullable-simple-commit object)
[PSCustomObject] $HeadCommit
# The head repository of the workflow run.
# Example: (minimal-repository object)
[GitHubRepository] $HeadRepository
# The event-specific title associated with the run or the run-name if set.
# Example: "Simple Workflow"
[string] $DisplayTitle
GitHubWorkflowRun() {}
GitHubWorkflowRun([PSCustomObject] $Object) {
# From GitHubNode
$this.ID = $Object.id
$this.NodeID = $Object.node_id
# From GitHubWorkflowRun
$this.Name = $Object.name
$this.Owner = [GitHubOwner]::new($Object.repository.owner)
$this.Repository = [GitHubRepository]::new($Object.repository)
$this.CheckSuiteID = $Object.check_suite_id
$this.CheckSuiteNodeID = $Object.check_suite_node_id
$this.HeadBranch = $Object.head_branch
$this.HeadSha = $Object.head_sha
$this.Path = $Object.path
$this.RunNumber = $Object.run_number
$this.RunAttempt = $Object.run_attempt
$this.ReferencedWorkflows = $Object.referenced_workflows
$this.Event = $Object.event
$this.Status = $Object.status
$this.Conclusion = $Object.conclusion
$this.WorkflowID = $Object.workflow_id
$this.Url = $Object.html_url
$this.PullRequests = $Object.pull_requests
$this.CreatedAt = $Object.created_at
$this.UpdatedAt = $Object.updated_at
$this.StartedAt = $Object.run_started_at
$this.Actor = [GitHubUser]::new($Object.actor)
$this.TriggeringActor = [GitHubUser]::new($Object.triggering_actor)
$this.HeadCommit = $Object.head_commit
$this.HeadRepository = [GitHubRepository]::new($Object.head_repository)
$this.DisplayTitle = $Object.display_title
}
}