Skip to content

Commit 176a6e9

Browse files
committed
Add test/fixtures/github_workflow_run.ex + context event json
1 parent 3c03ac1 commit 176a6e9

File tree

3 files changed

+230
-0
lines changed

3 files changed

+230
-0
lines changed

mix.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule ElixirScript.MixProject do
66
app: :elixir_script,
77
version: "0.0.0",
88
elixir: "~> 1.15",
9+
elixirc_paths: elixirc_paths(Mix.env()),
910
escript: escript(),
1011
deps: deps(),
1112
dialyzer: [
@@ -33,4 +34,7 @@ defmodule ElixirScript.MixProject do
3334
{:mox, "~> 1.0", only: :test}
3435
]
3536
end
37+
38+
defp elixirc_paths(:test), do: ["lib", "test/fixtures"]
39+
defp elixirc_paths(_), do: ["lib"]
3640
end

test/fixtures/github_workflow_run.ex

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
defmodule Test.Fixtures.GitHubWorkflowRun do
2+
@moduledoc """
3+
Fixture for a GitHub Workflow run
4+
"""
5+
@context_event_path "test/fixtures/github_workflow_run_context_event.json"
6+
7+
def env do
8+
%{
9+
"GITHUB_BASE_REF" => "",
10+
"GITHUB_REPOSITORY_ID" => "675841662",
11+
"GITHUB_ACTION_REF" => "v0",
12+
"GITHUB_EVENT_PATH" => @context_event_path,
13+
"GITHUB_PATH" => "/github/file_commands/add_path",
14+
"CI" => "true",
15+
"GITHUB_WORKSPACE" => "/github/workspace",
16+
"GITHUB_RUN_ATTEMPT" => "1",
17+
"GITHUB_OUTPUT" => "/github/file_commands/set_output",
18+
"GITHUB_REF" => "refs/heads/main",
19+
"GITHUB_REF_PROTECTED" => "false",
20+
"GITHUB_WORKFLOW_REF" =>
21+
"gaggle/elixir_script/.github/workflows/examples.yml@refs/heads/main",
22+
"GITHUB_STEP_SUMMARY" => "/github/file_commands/step_summary",
23+
"GITHUB_ACTOR_ID" => "2316447",
24+
"GITHUB_TRIGGERING_ACTOR" => "gaggle",
25+
"GITHUB_JOB" => "event-context-is-available",
26+
"GITHUB_WORKFLOW_SHA" => "77cefc59a7095f6b86508e8e26ff9f866da4b5e5",
27+
"GITHUB_API_URL" => "https://api.github.com",
28+
"GITHUB_ACTION" => "script",
29+
"GITHUB_REPOSITORY" => "gaggle/elixir_script",
30+
"GITHUB_ENV" => "/github/file_commands/set_env",
31+
"GITHUB_REPOSITORY_OWNER_ID" => "2316447",
32+
"GITHUB_SERVER_URL" => "https://github.com",
33+
"GITHUB_REF_TYPE" => "branch",
34+
"GITHUB_GRAPHQL_URL" => "https://api.github.com/graphql",
35+
"GITHUB_REF_NAME" => "main",
36+
"GITHUB_ACTOR" => "gaggle",
37+
"GITHUB_RUN_NUMBER" => "15",
38+
"GITHUB_SHA" => "77cefc59a7095f6b86508e8e26ff9f866da4b5e5",
39+
"GITHUB_RUN_ID" => "6922972178",
40+
"GITHUB_RETENTION_DAYS" => "90",
41+
"GITHUB_STATE" => "/github/file_commands/save_state",
42+
"GITHUB_ACTIONS" => "true",
43+
"GITHUB_WORKFLOW" => "Examples",
44+
"GITHUB_REPOSITORY_OWNER" => "gaggle",
45+
"GITHUB_EVENT_NAME" => "push",
46+
"GITHUB_ACTION_REPOSITORY" => "gaggle/elixir_script",
47+
"GITHUB_HEAD_REF" => ""
48+
}
49+
end
50+
end
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
{
2+
"after": "2ea150fa30b30dec0aeb85eb93469eda2d95c7d7",
3+
"base_ref": null,
4+
"before": "5ace270b6afc55dd3194d7e4cbf684ed753c2008",
5+
"commits": [
6+
{
7+
"author": {
8+
"email": "[email protected]",
9+
"name": "Jon Lauridsen",
10+
"username": "gaggle"
11+
},
12+
"committer": {
13+
"email": "[email protected]",
14+
"name": "Jon Lauridsen",
15+
"username": "gaggle"
16+
},
17+
"distinct": true,
18+
"id": "2ea150fa30b30dec0aeb85eb93469eda2d95c7d7",
19+
"message": "Output GITHUB_EVENT_PATH",
20+
"timestamp": "2023-11-19T22:53:38+01:00",
21+
"tree_id": "e7fa0dcfd93820a600f21dd33e5e30f3eae6c150",
22+
"url": "https://github.com/gaggle/elixir_script/commit/2ea150fa30b30dec0aeb85eb93469eda2d95c7d7"
23+
}
24+
],
25+
"compare": "https://github.com/gaggle/elixir_script/compare/5ace270b6afc...2ea150fa30b3",
26+
"created": false,
27+
"deleted": false,
28+
"forced": true,
29+
"head_commit": {
30+
"author": {
31+
"email": "[email protected]",
32+
"name": "Jon Lauridsen",
33+
"username": "gaggle"
34+
},
35+
"committer": {
36+
"email": "[email protected]",
37+
"name": "Jon Lauridsen",
38+
"username": "gaggle"
39+
},
40+
"distinct": true,
41+
"id": "2ea150fa30b30dec0aeb85eb93469eda2d95c7d7",
42+
"message": "Output GITHUB_EVENT_PATH",
43+
"timestamp": "2023-11-19T22:53:38+01:00",
44+
"tree_id": "e7fa0dcfd93820a600f21dd33e5e30f3eae6c150",
45+
"url": "https://github.com/gaggle/elixir_script/commit/2ea150fa30b30dec0aeb85eb93469eda2d95c7d7"
46+
},
47+
"pusher": {
48+
"email": "[email protected]",
49+
"name": "gaggle"
50+
},
51+
"ref": "refs/heads/atom-context",
52+
"repository": {
53+
"allow_forking": true,
54+
"archive_url": "https://api.github.com/repos/gaggle/elixir_script/{archive_format}{/ref}",
55+
"archived": false,
56+
"assignees_url": "https://api.github.com/repos/gaggle/elixir_script/assignees{/user}",
57+
"blobs_url": "https://api.github.com/repos/gaggle/elixir_script/git/blobs{/sha}",
58+
"branches_url": "https://api.github.com/repos/gaggle/elixir_script/branches{/branch}",
59+
"clone_url": "https://github.com/gaggle/elixir_script.git",
60+
"collaborators_url": "https://api.github.com/repos/gaggle/elixir_script/collaborators{/collaborator}",
61+
"comments_url": "https://api.github.com/repos/gaggle/elixir_script/comments{/number}",
62+
"commits_url": "https://api.github.com/repos/gaggle/elixir_script/commits{/sha}",
63+
"compare_url": "https://api.github.com/repos/gaggle/elixir_script/compare/{base}...{head}",
64+
"contents_url": "https://api.github.com/repos/gaggle/elixir_script/contents/{+path}",
65+
"contributors_url": "https://api.github.com/repos/gaggle/elixir_script/contributors",
66+
"created_at": 1691443361,
67+
"default_branch": "main",
68+
"deployments_url": "https://api.github.com/repos/gaggle/elixir_script/deployments",
69+
"description": "Run simple Elixir scripts, easily",
70+
"disabled": false,
71+
"downloads_url": "https://api.github.com/repos/gaggle/elixir_script/downloads",
72+
"events_url": "https://api.github.com/repos/gaggle/elixir_script/events",
73+
"fork": false,
74+
"forks": 0,
75+
"forks_count": 0,
76+
"forks_url": "https://api.github.com/repos/gaggle/elixir_script/forks",
77+
"full_name": "gaggle/elixir_script",
78+
"git_commits_url": "https://api.github.com/repos/gaggle/elixir_script/git/commits{/sha}",
79+
"git_refs_url": "https://api.github.com/repos/gaggle/elixir_script/git/refs{/sha}",
80+
"git_tags_url": "https://api.github.com/repos/gaggle/elixir_script/git/tags{/sha}",
81+
"git_url": "git://github.com/gaggle/elixir_script.git",
82+
"has_discussions": false,
83+
"has_downloads": true,
84+
"has_issues": true,
85+
"has_pages": false,
86+
"has_projects": false,
87+
"has_wiki": false,
88+
"homepage": "https://github.com/marketplace/actions/elixir-script",
89+
"hooks_url": "https://api.github.com/repos/gaggle/elixir_script/hooks",
90+
"html_url": "https://github.com/gaggle/elixir_script",
91+
"id": 675841662,
92+
"is_template": false,
93+
"issue_comment_url": "https://api.github.com/repos/gaggle/elixir_script/issues/comments{/number}",
94+
"issue_events_url": "https://api.github.com/repos/gaggle/elixir_script/issues/events{/number}",
95+
"issues_url": "https://api.github.com/repos/gaggle/elixir_script/issues{/number}",
96+
"keys_url": "https://api.github.com/repos/gaggle/elixir_script/keys{/key_id}",
97+
"labels_url": "https://api.github.com/repos/gaggle/elixir_script/labels{/name}",
98+
"language": "Elixir",
99+
"languages_url": "https://api.github.com/repos/gaggle/elixir_script/languages",
100+
"license": null,
101+
"master_branch": "main",
102+
"merges_url": "https://api.github.com/repos/gaggle/elixir_script/merges",
103+
"milestones_url": "https://api.github.com/repos/gaggle/elixir_script/milestones{/number}",
104+
"mirror_url": null,
105+
"name": "elixir_script",
106+
"node_id": "R_kgDOKEiGfg",
107+
"notifications_url": "https://api.github.com/repos/gaggle/elixir_script/notifications{?since,all,participating}",
108+
"open_issues": 0,
109+
"open_issues_count": 0,
110+
"owner": {
111+
"avatar_url": "https://avatars.githubusercontent.com/u/2316447?v=4",
112+
"email": "[email protected]",
113+
"events_url": "https://api.github.com/users/gaggle/events{/privacy}",
114+
"followers_url": "https://api.github.com/users/gaggle/followers",
115+
"following_url": "https://api.github.com/users/gaggle/following{/other_user}",
116+
"gists_url": "https://api.github.com/users/gaggle/gists{/gist_id}",
117+
"gravatar_id": "",
118+
"html_url": "https://github.com/gaggle",
119+
"id": 2316447,
120+
"login": "gaggle",
121+
"name": "gaggle",
122+
"node_id": "MDQ6VXNlcjIzMTY0NDc=",
123+
"organizations_url": "https://api.github.com/users/gaggle/orgs",
124+
"received_events_url": "https://api.github.com/users/gaggle/received_events",
125+
"repos_url": "https://api.github.com/users/gaggle/repos",
126+
"site_admin": false,
127+
"starred_url": "https://api.github.com/users/gaggle/starred{/owner}{/repo}",
128+
"subscriptions_url": "https://api.github.com/users/gaggle/subscriptions",
129+
"type": "User",
130+
"url": "https://api.github.com/users/gaggle"
131+
},
132+
"private": false,
133+
"pulls_url": "https://api.github.com/repos/gaggle/elixir_script/pulls{/number}",
134+
"pushed_at": 1700430826,
135+
"releases_url": "https://api.github.com/repos/gaggle/elixir_script/releases{/id}",
136+
"size": 105,
137+
"ssh_url": "[email protected]:gaggle/elixir_script.git",
138+
"stargazers": 0,
139+
"stargazers_count": 0,
140+
"stargazers_url": "https://api.github.com/repos/gaggle/elixir_script/stargazers",
141+
"statuses_url": "https://api.github.com/repos/gaggle/elixir_script/statuses/{sha}",
142+
"subscribers_url": "https://api.github.com/repos/gaggle/elixir_script/subscribers",
143+
"subscription_url": "https://api.github.com/repos/gaggle/elixir_script/subscription",
144+
"svn_url": "https://github.com/gaggle/elixir_script",
145+
"tags_url": "https://api.github.com/repos/gaggle/elixir_script/tags",
146+
"teams_url": "https://api.github.com/repos/gaggle/elixir_script/teams",
147+
"topics": [],
148+
"trees_url": "https://api.github.com/repos/gaggle/elixir_script/git/trees{/sha}",
149+
"updated_at": "2023-11-18T16:35:54Z",
150+
"url": "https://github.com/gaggle/elixir_script",
151+
"visibility": "public",
152+
"watchers": 0,
153+
"watchers_count": 0,
154+
"web_commit_signoff_required": false
155+
},
156+
"sender": {
157+
"avatar_url": "https://avatars.githubusercontent.com/u/2316447?v=4",
158+
"events_url": "https://api.github.com/users/gaggle/events{/privacy}",
159+
"followers_url": "https://api.github.com/users/gaggle/followers",
160+
"following_url": "https://api.github.com/users/gaggle/following{/other_user}",
161+
"gists_url": "https://api.github.com/users/gaggle/gists{/gist_id}",
162+
"gravatar_id": "",
163+
"html_url": "https://github.com/gaggle",
164+
"id": 2316447,
165+
"login": "gaggle",
166+
"node_id": "MDQ6VXNlcjIzMTY0NDc=",
167+
"organizations_url": "https://api.github.com/users/gaggle/orgs",
168+
"received_events_url": "https://api.github.com/users/gaggle/received_events",
169+
"repos_url": "https://api.github.com/users/gaggle/repos",
170+
"site_admin": false,
171+
"starred_url": "https://api.github.com/users/gaggle/starred{/owner}{/repo}",
172+
"subscriptions_url": "https://api.github.com/users/gaggle/subscriptions",
173+
"type": "User",
174+
"url": "https://api.github.com/users/gaggle"
175+
}
176+
}

0 commit comments

Comments
 (0)