Skip to content

Commit d14df0f

Browse files
committed
Inline old version of GH actions parser/interpreter
1 parent 0236213 commit d14df0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+666
-39
lines changed

next.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
webpack: (config, { isServer }) => {
3+
// Fixes npm packages that depend on `fs` module
4+
if (!isServer) {
5+
config.node = {
6+
fs: "empty",
7+
};
8+
}
9+
10+
return config;
11+
},
12+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"dependencies": {
1010
"@primer/components": "18.1.0",
1111
"@primer/octicons-v2-react": "0.0.0-dd899ea",
12+
"chevrotain": "^7.1.0",
1213
"codemirror": "^5.53.2",
1314
"codemirror-github-dark": "^0.4.1",
14-
"github-actions-interpreter": "0.5.1-1",
1515
"github-markdown-css": "^4.0.0",
1616
"lz-string": "^1.4.4",
1717
"next": "^9.4.0",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as React from "react";
2+
export declare const ConnectorPoints: React.FC<{
3+
workflowVisId: number;
4+
connectorId: string;
5+
}>;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import * as React from "react";
2+
import { Event } from "../lib/runtimeModel";
3+
export declare const WorkflowEvent: React.FC<{
4+
id: number;
5+
event: Event;
6+
}>;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="react" />
2+
import { Conclusion } from "../lib/runtimeModel";
3+
export declare function conclusionToIcon(conclusion: Conclusion): JSX.Element;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as React from "react";
2+
import { RuntimeJob } from "../lib/runtimeModel";
3+
export declare const Job: React.FC<{
4+
className?: string;
5+
workflowVisId: number;
6+
job: RuntimeJob;
7+
connectable?: boolean;
8+
}>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as React from "react";
2+
export declare const JobBox: React.FC<{
3+
workflowVisId: number;
4+
header: JSX.Element;
5+
headerClassname?: string;
6+
content: JSX.Element;
7+
connectorId?: string;
8+
}>;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { RuntimeJob } from "../lib/runtimeModel";
2+
/**
3+
* Group jobs according to their level (distance from the root in the dependency graph)
4+
* @param jobs List of jobs
5+
*/
6+
export declare function groupJobs(jobs: RuntimeJob[]): RuntimeJob[][];
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as React from "react";
2+
import { RuntimeJob } from "../lib/runtimeModel";
3+
export declare const MatrixJob: React.FC<{
4+
workflowVisId: number;
5+
connectorId: string;
6+
title: string;
7+
jobs: RuntimeJob[];
8+
}>;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as React from "react";
2+
export declare class Connectors extends React.PureComponent<{
3+
elements: {
4+
from: string;
5+
to: string;
6+
color?: string;
7+
}[];
8+
overlay: number;
9+
selector: string;
10+
strokeWidth: number;
11+
color: string;
12+
}> {
13+
static defaultProps: {
14+
overlay: number;
15+
strokeWidth: number;
16+
color: string;
17+
};
18+
svgContainer: React.RefObject<HTMLDivElement>;
19+
svg: React.RefObject<SVGSVGElement>;
20+
componentDidMount(): void;
21+
componentDidUpdate(): void;
22+
checkSelector: () => void;
23+
connectAll: () => void;
24+
render(): JSX.Element;
25+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare const drawPath: (svg: any, path: any, startX: any, startY: any, endX: any, endY: any) => void;
2+
export declare const connectElements: (container: any, svg: any, path: any, startElem: any, endElem: any) => void;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as React from "react";
2+
import { RuntimeStep } from "../lib/runtimeModel";
3+
export declare const Step: React.FC<{
4+
step: RuntimeStep;
5+
}>;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare function makeSafeForCSS(name: string): string;
2+
export declare function flatten<T>(arr: T[][]): T[];
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as React from "react";
2+
import { Event, RuntimeModel } from "../lib/runtimeModel";
3+
export declare const WorkflowExecution: React.FC<{
4+
id: number;
5+
events: Event[];
6+
executionModel: RuntimeModel;
7+
}>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { RuntimeContexts } from "./lib/expressions";
2+
export { WorkflowExecution } from "./components/workflowExecution";
3+
export { evaluateExpression, ExpressionError, parseExpression, replaceExpressions, } from "./lib/expressions/index";
4+
export { parse, ParseError } from "./lib/parser/parser";
5+
export { run, RunError } from "./lib/runner/runner";
6+
export * from "./lib/runtimeModel";
7+
export * from "./lib/workflow";
8+
export type { RuntimeContexts };

src/github-actions-interpreter/index.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github-actions-interpreter/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github-actions-interpreter/index.modern.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github-actions-interpreter/index.modern.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github-actions-interpreter/index.umd.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/github-actions-interpreter/index.umd.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare type IssueActivities = "opened" | "edited" | "deleted" | "transferred" | "pinned" | "unpinned" | "closed" | "reopened" | "assigned" | "unassigned" | "labeled" | "unlabeled" | "locked" | "unlocked" | "milestoned" | "demilestoned";
2+
export declare type PullRequestActivities = "assigned" | "unassigned" | "labeled" | "unlabeled" | "opened" | "edited" | "closed" | "reopened" | "synchronize" | "ready_for_review" | "locked" | "unlocked" | "review_requested" | "review_request_removed";
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
export declare function getEventPayload(event: string): {
2+
after: string;
3+
base_ref: any;
4+
before: string;
5+
commits: {
6+
author: {
7+
email: string;
8+
name: string;
9+
username: string;
10+
};
11+
committer: {
12+
email: string;
13+
name: string;
14+
username: string;
15+
};
16+
distinct: boolean;
17+
id: string;
18+
message: string;
19+
timestamp: string;
20+
tree_id: string;
21+
url: string;
22+
}[];
23+
compare: string;
24+
created: boolean;
25+
deleted: boolean;
26+
forced: boolean;
27+
head_commit: {
28+
author: {
29+
email: string;
30+
name: string;
31+
username: string;
32+
};
33+
committer: {
34+
email: string;
35+
name: string;
36+
username: string;
37+
};
38+
distinct: boolean;
39+
id: string;
40+
message: string;
41+
timestamp: string;
42+
tree_id: string;
43+
url: string;
44+
};
45+
organization: {
46+
avatar_url: string;
47+
description: string;
48+
events_url: string;
49+
hooks_url: string;
50+
id: number;
51+
issues_url: string;
52+
login: string;
53+
members_url: string;
54+
node_id: string;
55+
public_members_url: string;
56+
repos_url: string;
57+
url: string;
58+
};
59+
pusher: {
60+
email: string;
61+
name: string;
62+
};
63+
ref: string;
64+
repository: {
65+
archive_url: string;
66+
archived: boolean;
67+
assignees_url: string;
68+
blobs_url: string;
69+
branches_url: string;
70+
clone_url: string;
71+
collaborators_url: string;
72+
comments_url: string;
73+
commits_url: string;
74+
compare_url: string;
75+
contents_url: string;
76+
contributors_url: string;
77+
created_at: number;
78+
default_branch: string;
79+
deployments_url: string;
80+
description: any;
81+
disabled: boolean;
82+
downloads_url: string;
83+
events_url: string;
84+
fork: boolean;
85+
forks: number;
86+
forks_count: number;
87+
forks_url: string;
88+
full_name: string;
89+
git_commits_url: string;
90+
git_refs_url: string;
91+
git_tags_url: string;
92+
git_url: string;
93+
has_downloads: boolean;
94+
has_issues: boolean;
95+
has_pages: boolean;
96+
has_projects: boolean;
97+
has_wiki: boolean;
98+
homepage: any;
99+
hooks_url: string;
100+
html_url: string;
101+
id: number;
102+
issue_comment_url: string;
103+
issue_events_url: string;
104+
issues_url: string;
105+
keys_url: string;
106+
labels_url: string;
107+
language: any;
108+
languages_url: string;
109+
license: any;
110+
master_branch: string;
111+
merges_url: string;
112+
milestones_url: string;
113+
mirror_url: any;
114+
name: string;
115+
node_id: string;
116+
notifications_url: string;
117+
open_issues: number;
118+
open_issues_count: number;
119+
organization: string;
120+
owner: {
121+
avatar_url: string;
122+
email: any;
123+
events_url: string;
124+
followers_url: string;
125+
following_url: string;
126+
gists_url: string;
127+
gravatar_id: string;
128+
html_url: string;
129+
id: number;
130+
login: string;
131+
name: string;
132+
node_id: string;
133+
organizations_url: string;
134+
received_events_url: string;
135+
repos_url: string;
136+
site_admin: boolean;
137+
starred_url: string;
138+
subscriptions_url: string;
139+
type: string;
140+
url: string;
141+
};
142+
private: boolean;
143+
pulls_url: string;
144+
pushed_at: number;
145+
releases_url: string;
146+
size: number;
147+
ssh_url: string;
148+
stargazers: number;
149+
stargazers_count: number;
150+
stargazers_url: string;
151+
statuses_url: string;
152+
subscribers_url: string;
153+
subscription_url: string;
154+
svn_url: string;
155+
tags_url: string;
156+
teams_url: string;
157+
trees_url: string;
158+
updated_at: string;
159+
url: string;
160+
watchers: number;
161+
watchers_count: number;
162+
};
163+
sender: {
164+
avatar_url: string;
165+
events_url: string;
166+
followers_url: string;
167+
following_url: string;
168+
gists_url: string;
169+
gravatar_id: string;
170+
html_url: string;
171+
id: number;
172+
login: string;
173+
node_id: string;
174+
organizations_url: string;
175+
received_events_url: string;
176+
repos_url: string;
177+
site_admin: boolean;
178+
starred_url: string;
179+
subscriptions_url: string;
180+
type: string;
181+
url: string;
182+
};
183+
} | {
184+
after?: undefined;
185+
base_ref?: undefined;
186+
before?: undefined;
187+
commits?: undefined;
188+
compare?: undefined;
189+
created?: undefined;
190+
deleted?: undefined;
191+
forced?: undefined;
192+
head_commit?: undefined;
193+
organization?: undefined;
194+
pusher?: undefined;
195+
ref?: undefined;
196+
repository?: undefined;
197+
sender?: undefined;
198+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { IExpressionContext } from "./evaluator";
2+
export declare function doComplete(input: string, context: IExpressionContext): any[];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { BaseCstVisitor } from "./parser";
2+
export interface RuntimeContexts {
3+
github: any;
4+
env?: any;
5+
job?: any;
6+
steps?: any;
7+
runner?: any;
8+
secrets?: {
9+
[key: string]: string;
10+
};
11+
strategy?: any;
12+
matrix?: any;
13+
needs?: any;
14+
}
15+
export interface IExpressionContext {
16+
contexts: RuntimeContexts;
17+
}
18+
/**
19+
* This evaluates an expression by operation on the CST produced by the parser.
20+
*/
21+
declare class ExpressionEvaluator extends BaseCstVisitor {
22+
expression(ctx: any, context: IExpressionContext): any;
23+
subExpression(ctx: any, context: IExpressionContext): any;
24+
contextAccess(ctx: any, context: IExpressionContext): any;
25+
contextMember(ctx: any, contextObject: any): any;
26+
contextDotMember(ctx: any, contextObject: any): any;
27+
contextBoxMember(ctx: any, contextObject: any): any;
28+
logicalGrouping(ctx: any): any;
29+
array(ctx: any): any[];
30+
functionCall(ctx: any, context: IExpressionContext): string | boolean;
31+
value(ctx: any): any;
32+
booleanValue(ctx: any): boolean;
33+
private _coerceValue;
34+
private _removeQuotes;
35+
}
36+
export declare const evaluator: ExpressionEvaluator;
37+
export {};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export declare function contains<S extends T[] | string, T>(haystack: S, needle: T): boolean;
2+
export declare function startsWith(haystack: string, needle: string): boolean;
3+
export declare function endsWith(haystack: string, needle: string): boolean;
4+
export declare function join<T>(arr: T[], separator?: string): string;
5+
export declare function toJson(input: unknown): string;

0 commit comments

Comments
 (0)