From 7652057da238bdbd48923da426b13750fb9d61fc Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:07:59 +0200 Subject: [PATCH] docker-container: write github actions payload to container for provenance Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- driver/docker-container/driver.go | 41 +- driver/docker-container/factory.go | 12 +- tests/create.go | 30 + util/ghutil/fixtures/ghactx_pr.env | 106 ++++ util/ghutil/fixtures/ghactx_pr_event.json | 542 ++++++++++++++++ util/ghutil/fixtures/ghactx_pr_expected.json | 587 ++++++++++++++++++ util/ghutil/fixtures/ghactx_push.env | 106 ++++ util/ghutil/fixtures/ghactx_push_event.json | 230 +++++++ .../ghutil/fixtures/ghactx_push_expected.json | 263 ++++++++ util/ghutil/fixtures/ghactx_tag.env | 106 ++++ util/ghutil/fixtures/ghactx_tag_event.json | 193 ++++++ util/ghutil/fixtures/ghactx_tag_expected.json | 228 +++++++ util/ghutil/ghutil.go | 145 +++++ util/ghutil/ghutil_test.go | 28 + 14 files changed, 2600 insertions(+), 17 deletions(-) create mode 100644 util/ghutil/fixtures/ghactx_pr.env create mode 100644 util/ghutil/fixtures/ghactx_pr_event.json create mode 100644 util/ghutil/fixtures/ghactx_pr_expected.json create mode 100644 util/ghutil/fixtures/ghactx_push.env create mode 100644 util/ghutil/fixtures/ghactx_push_event.json create mode 100644 util/ghutil/fixtures/ghactx_push_expected.json create mode 100644 util/ghutil/fixtures/ghactx_tag.env create mode 100644 util/ghutil/fixtures/ghactx_tag_event.json create mode 100644 util/ghutil/fixtures/ghactx_tag_expected.json create mode 100644 util/ghutil/ghutil.go create mode 100644 util/ghutil/ghutil_test.go diff --git a/driver/docker-container/driver.go b/driver/docker-container/driver.go index ce37fcea4..4f26f17c8 100644 --- a/driver/docker-container/driver.go +++ b/driver/docker-container/driver.go @@ -16,6 +16,7 @@ import ( "github.com/docker/buildx/driver" "github.com/docker/buildx/driver/bkimage" "github.com/docker/buildx/util/confutil" + "github.com/docker/buildx/util/ghutil" "github.com/docker/buildx/util/imagetools" "github.com/docker/buildx/util/progress" "github.com/docker/cli/cli/context/docker" @@ -43,20 +44,21 @@ type Driver struct { // if you add fields, remember to update docs: // https://github.com/docker/docs/blob/main/content/build/drivers/docker-container.md - netMode string - image string - memory opts.MemBytes - memorySwap opts.MemSwapBytes - cpuQuota int64 - cpuPeriod int64 - cpuShares int64 - cpusetCpus string - cpusetMems string - cgroupParent string - restartPolicy container.RestartPolicy - env []string - defaultLoad bool - gpus []container.DeviceRequest + netMode string + image string + memory opts.MemBytes + memorySwap opts.MemSwapBytes + cpuQuota int64 + cpuPeriod int64 + cpuShares int64 + cpusetCpus string + cpusetMems string + cgroupParent string + restartPolicy container.RestartPolicy + env []string + defaultLoad bool + gpus []container.DeviceRequest + writeProvenanceGHA bool } func (d *Driver) IsMobyDriver() bool { @@ -137,6 +139,17 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error { }, } + if d.writeProvenanceGHA { + if ghactx, err := ghutil.GithubActionsContext(); err != nil { + return err + } else if ghactx != nil { + if d.Files == nil { + d.Files = make(map[string][]byte) + } + d.Files["provenance.d/github_actions_context.json"] = ghactx + } + } + // Mount WSL libaries if running in WSL environment and Docker context // is a local socket as requesting GPU on container builder creation // is not enough when generating the CDI specification for GPU devices. diff --git a/driver/docker-container/factory.go b/driver/docker-container/factory.go index dba791b61..06e9c503a 100644 --- a/driver/docker-container/factory.go +++ b/driver/docker-container/factory.go @@ -47,9 +47,10 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver return nil, err } d := &Driver{ - factory: f, - InitConfig: cfg, - restartPolicy: rp, + factory: f, + InitConfig: cfg, + restartPolicy: rp, + writeProvenanceGHA: true, } var gpus dockeropts.GpuOpts if err := gpus.Set("all"); err == nil { @@ -111,6 +112,11 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver return nil, errors.Errorf("invalid env option %q, expecting env.FOO=bar", k) } d.env = append(d.env, fmt.Sprintf("%s=%s", envName, v)) + case k == "provenance-add-gha": + d.writeProvenanceGHA, err = strconv.ParseBool(v) + if err != nil { + return nil, err + } default: return nil, errors.Errorf("invalid driver option %s for docker-container driver", k) } diff --git a/tests/create.go b/tests/create.go index d49f34bb2..093351974 100644 --- a/tests/create.go +++ b/tests/create.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "os" + "path/filepath" "strings" "testing" @@ -23,6 +24,7 @@ var createTests = []func(t *testing.T, sb integration.Sandbox){ testCreateMemoryLimit, testCreateRestartAlways, testCreateRemoteContainer, + testCreateWithProvenanceGHA, } func testCreateMemoryLimit(t *testing.T, sb integration.Sandbox) { @@ -108,3 +110,31 @@ func testCreateRemoteContainer(t *testing.T, sb integration.Sandbox) { } require.Fail(t, "remote builder is not running") } + +func testCreateWithProvenanceGHA(t *testing.T, sb integration.Sandbox) { + if !isDockerContainerWorker(sb) { + t.Skip("only testing with docker-container worker") + } + + var builderName string + t.Cleanup(func() { + if builderName == "" { + return + } + out, err := rmCmd(sb, withArgs(builderName)) + require.NoError(t, err, out) + }) + + ghep := filepath.Join(t.TempDir(), "event.json") + require.NoError(t, os.WriteFile(ghep, []byte(`{"test":{"foo":"bar"}}`), 0644)) + + out, err := createCmd(sb, + withArgs("--driver", "docker-container"), + withEnv("GITHUB_ACTIONS=true", "GITHUB_EVENT_NAME=push", "GITHUB_EVENT_PATH="+ghep), + ) + require.NoError(t, err, out) + builderName = strings.TrimSpace(out) + + out, err = inspectCmd(sb, withArgs(builderName, "--bootstrap")) + require.NoError(t, err, out) +} diff --git a/util/ghutil/fixtures/ghactx_pr.env b/util/ghutil/fixtures/ghactx_pr.env new file mode 100644 index 000000000..0795bb725 --- /dev/null +++ b/util/ghutil/fixtures/ghactx_pr.env @@ -0,0 +1,106 @@ +ACCEPT_EULA=Y +ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=/opt/actionarchivecache +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache +ANDROID_HOME=/usr/local/lib/android/sdk +ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/28.2.13676358 +ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_SDK_ROOT=/usr/local/lib/android/sdk +ANT_HOME=/usr/share/ant +AZURE_EXTENSION_DIR=/opt/az/azcliextensions +BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +CHROMEWEBDRIVER=/usr/local/share/chromedriver-linux64 +CHROME_BIN=/usr/bin/google-chrome +CI=true +CONDA=/usr/share/miniconda +DEBIAN_FRONTEND=noninteractive +DOTNET_MULTILEVEL_LOOKUP=0 +DOTNET_NOLOGO=1 +DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +EDGEWEBDRIVER=/usr/local/share/edge_driver +ENABLE_RUNNER_TRACING=true +GECKOWEBDRIVER=/usr/local/share/gecko_driver +GHCUP_INSTALL_BASE_PREFIX=/usr/local +GITHUB_ACTION=__run +GITHUB_ACTIONS=true +GITHUB_ACTION_REF= +GITHUB_ACTION_REPOSITORY= +GITHUB_ACTOR=crazy-max +GITHUB_ACTOR_ID=1951866 +GITHUB_API_URL=https://api.github.com +GITHUB_BASE_REF=master +GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_33a5ccf0-43cf-4794-91bc-98abed829158 +GITHUB_EVENT_NAME=pull_request +GITHUB_EVENT_PATH=./fixtures/ghactx_pr_event.json +GITHUB_GRAPHQL_URL=https://api.github.com/graphql +GITHUB_HEAD_REF=ghutil +GITHUB_JOB=ghutil +GITHUB_OUTPUT=/home/runner/work/_temp/_runner_file_commands/set_output_33a5ccf0-43cf-4794-91bc-98abed829158 +GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_33a5ccf0-43cf-4794-91bc-98abed829158 +GITHUB_REF=refs/pull/55/merge +GITHUB_REF_NAME=55/merge +GITHUB_REF_PROTECTED=false +GITHUB_REF_TYPE=branch +GITHUB_REPOSITORY=docker/test-docker-action +GITHUB_REPOSITORY_ID=285789493 +GITHUB_REPOSITORY_OWNER=docker +GITHUB_REPOSITORY_OWNER_ID=5429470 +GITHUB_RETENTION_DAYS=90 +GITHUB_RUN_ATTEMPT=1 +GITHUB_RUN_ID=18774179609 +GITHUB_RUN_NUMBER=2 +GITHUB_SERVER_URL=https://github.com +GITHUB_SHA=198c644a687204e604c8476ad23d7d5bbb0dc221 +GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_33a5ccf0-43cf-4794-91bc-98abed829158 +GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_33a5ccf0-43cf-4794-91bc-98abed829158 +GITHUB_TRIGGERING_ACTOR=crazy-max +GITHUB_WORKFLOW=ghutil +GITHUB_WORKFLOW_REF=docker/test-docker-action/.github/workflows/ghutil.yml@refs/pull/55/merge +GITHUB_WORKFLOW_SHA=198c644a687204e604c8476ad23d7d5bbb0dc221 +GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action +GOROOT_1_22_X64=/opt/hostedtoolcache/go/1.22.12/x64 +GOROOT_1_23_X64=/opt/hostedtoolcache/go/1.23.12/x64 +GOROOT_1_24_X64=/opt/hostedtoolcache/go/1.24.7/x64 +GRADLE_HOME=/usr/share/gradle-9.1.0 +HOME=/home/runner +HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650 +HOMEBREW_NO_AUTO_UPDATE=1 +INVOCATION_ID=d3fd0f4a6372458dbf53aa6d6abd62b0 +ImageOS=ubuntu24 +ImageVersion=20250929.60.1 +JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_11_X64=/usr/lib/jvm/temurin-11-jdk-amd64 +JAVA_HOME_17_X64=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_21_X64=/usr/lib/jvm/temurin-21-jdk-amd64 +JAVA_HOME_25_X64=/usr/lib/jvm/temurin-25-jdk-amd64 +JAVA_HOME_8_X64=/usr/lib/jvm/temurin-8-jdk-amd64 +JOURNAL_STREAM=9:12643 +LANG=C.UTF-8 +LOGNAME=runner +MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/hosted-compute-agent.service/memory.pressure +MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= +NVM_DIR=/home/runner/.nvm +PATH=/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin +PIPX_BIN_DIR=/opt/pipx_bin +PIPX_HOME=/opt/pipx +POWERSHELL_DISTRIBUTION_CHANNEL=GitHub-Actions-ubuntu24 +RUNNER_ARCH=X64 +RUNNER_ENVIRONMENT=github-hosted +RUNNER_NAME=GitHub Actions 1002237010 +RUNNER_OS=Linux +RUNNER_TEMP=/home/runner/work/_temp +RUNNER_TOOL_CACHE=/opt/hostedtoolcache +RUNNER_TRACKING_ID=github_aef5ac41-9cf7-4195-9da9-851d8b29e68e +RUNNER_WORKSPACE=/home/runner/work/test-docker-action +SELENIUM_JAR_PATH=/usr/share/java/selenium-server.jar +SGX_AESM_ADDR=1 +SHELL=/bin/bash +SHLVL=1 +SWIFT_PATH=/usr/share/swift/usr/bin +SYSTEMD_EXEC_PID=1762 +USER=runner +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +XDG_CONFIG_HOME=/home/runner/.config +XDG_RUNTIME_DIR=/run/user/1001 +_=/usr/bin/env \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_pr_event.json b/util/ghutil/fixtures/ghactx_pr_event.json new file mode 100644 index 000000000..42bd21907 --- /dev/null +++ b/util/ghutil/fixtures/ghactx_pr_event.json @@ -0,0 +1,542 @@ +{ + "action": "synchronize", + "after": "3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "before": "c89d99c85a2603825bf11a688a446cfb50488deb", + "enterprise": { + "avatar_url": "https://avatars.githubusercontent.com/b/19176?v=4", + "created_at": "2022-12-30T23:53:17Z", + "description": null, + "html_url": "https://github.com/enterprises/docker", + "id": 19176, + "name": "Docker", + "node_id": "E_kgDNSug", + "slug": "docker", + "updated_at": "2025-10-20T20:39:05Z", + "website_url": null + }, + "number": 55, + "organization": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url": "https://api.github.com/orgs/docker/events", + "hooks_url": "https://api.github.com/orgs/docker/hooks", + "id": 5429470, + "issues_url": "https://api.github.com/orgs/docker/issues", + "login": "docker", + "members_url": "https://api.github.com/orgs/docker/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url": "https://api.github.com/orgs/docker/public_members{/member}", + "repos_url": "https://api.github.com/orgs/docker/repos", + "url": "https://api.github.com/orgs/docker" + }, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/docker/test-docker-action/issues/55/comments" + }, + "commits": { + "href": "https://api.github.com/repos/docker/test-docker-action/pulls/55/commits" + }, + "html": { + "href": "https://github.com/docker/test-docker-action/pull/55" + }, + "issue": { + "href": "https://api.github.com/repos/docker/test-docker-action/issues/55" + }, + "review_comment": { + "href": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/docker/test-docker-action/pulls/55/comments" + }, + "self": { + "href": "https://api.github.com/repos/docker/test-docker-action/pulls/55" + }, + "statuses": { + "href": "https://api.github.com/repos/docker/test-docker-action/statuses/3be79a9f0a68f4a7b93c001d377d9397663f6a5f" + } + }, + "active_lock_reason": null, + "additions": 25, + "assignee": null, + "assignees": [], + "author_association": "MEMBER", + "auto_merge": null, + "base": { + "label": "docker:master", + "ref": "master", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url": "https://github.com/docker/test-docker-action.git", + "collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at": "2020-08-07T09:23:00Z", + "default_branch": "master", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments", + "description": "Test \"Docker\" Actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url": "https://api.github.com/repos/docker/test-docker-action/events", + "fork": false, + "forks": 1, + "forks_count": 1, + "forks_url": "https://api.github.com/repos/docker/test-docker-action/forks", + "full_name": "docker/test-docker-action", + "git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url": "git://github.com/docker/test-docker-action.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": false, + "has_wiki": false, + "homepage": "", + "hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url": "https://github.com/docker/test-docker-action", + "id": 285789493, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language": "JavaScript", + "languages_url": "https://api.github.com/repos/docker/test-docker-action/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url": null, + "name": "test-docker-action", + "node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues": 16, + "open_issues_count": 16, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url": "https://api.github.com/users/docker/events{/privacy}", + "followers_url": "https://api.github.com/users/docker/followers", + "following_url": "https://api.github.com/users/docker/following{/other_user}", + "gists_url": "https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/docker", + "id": 5429470, + "login": "docker", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url": "https://api.github.com/users/docker/orgs", + "received_events_url": "https://api.github.com/users/docker/received_events", + "repos_url": "https://api.github.com/users/docker/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/docker/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/docker", + "user_view_type": "public" + }, + "private": true, + "pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at": "2025-09-29T14:04:23Z", + "releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size": 1374, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:docker/test-docker-action.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url": "https://github.com/docker/test-docker-action", + "tags_url": "https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url": "https://api.github.com/repos/docker/test-docker-action/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at": "2025-09-29T14:04:27Z", + "url": "https://api.github.com/repos/docker/test-docker-action", + "use_squash_pr_title_as_default": false, + "visibility": "internal", + "watchers": 1, + "watchers_count": 1, + "web_commit_signoff_required": false + }, + "sha": "231cbfa88dca156930d8e7991b6cf57bc09fd090", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url": "https://api.github.com/users/docker/events{/privacy}", + "followers_url": "https://api.github.com/users/docker/followers", + "following_url": "https://api.github.com/users/docker/following{/other_user}", + "gists_url": "https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/docker", + "id": 5429470, + "login": "docker", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url": "https://api.github.com/users/docker/orgs", + "received_events_url": "https://api.github.com/users/docker/received_events", + "repos_url": "https://api.github.com/users/docker/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/docker/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/docker", + "user_view_type": "public" + } + }, + "body": null, + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/docker/test-docker-action/issues/55/comments", + "commits": 1, + "commits_url": "https://api.github.com/repos/docker/test-docker-action/pulls/55/commits", + "created_at": "2025-10-24T08:25:26Z", + "deletions": 0, + "diff_url": "https://github.com/docker/test-docker-action/pull/55.diff", + "draft": false, + "head": { + "label": "crazy-max:ghutil", + "ref": "ghutil", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}", + "blobs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}", + "clone_url": "https://github.com/crazy-max/test-docker-action.git", + "collaborators_url": "https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}", + "commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}", + "compare_url": "https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}", + "contributors_url": "https://api.github.com/repos/crazy-max/test-docker-action/contributors", + "created_at": "2021-07-11T17:34:22Z", + "default_branch": "master", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/crazy-max/test-docker-action/deployments", + "description": "Test \"Docker\" Actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/crazy-max/test-docker-action/downloads", + "events_url": "https://api.github.com/repos/crazy-max/test-docker-action/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/crazy-max/test-docker-action/forks", + "full_name": "crazy-max/test-docker-action", + "git_commits_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}", + "git_url": "git://github.com/crazy-max/test-docker-action.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": false, + "has_pages": false, + "has_projects": true, + "has_wiki": false, + "homepage": "", + "hooks_url": "https://api.github.com/repos/crazy-max/test-docker-action/hooks", + "html_url": "https://github.com/crazy-max/test-docker-action", + "id": 385013169, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}", + "issues_url": "https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}", + "keys_url": "https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}", + "labels_url": "https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}", + "language": "JavaScript", + "languages_url": "https://api.github.com/repos/crazy-max/test-docker-action/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/crazy-max/test-docker-action/merges", + "milestones_url": "https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}", + "mirror_url": null, + "name": "test-docker-action", + "node_id": "MDEwOlJlcG9zaXRvcnkzODUwMTMxNjk=", + "notifications_url": "https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}", + "open_issues": 0, + "open_issues_count": 0, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + }, + "private": true, + "pulls_url": "https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}", + "pushed_at": "2025-10-24T08:27:13Z", + "releases_url": "https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}", + "size": 1078, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:crazy-max/test-docker-action.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/crazy-max/test-docker-action/stargazers", + "statuses_url": "https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscribers", + "subscription_url": "https://api.github.com/repos/crazy-max/test-docker-action/subscription", + "svn_url": "https://github.com/crazy-max/test-docker-action", + "tags_url": "https://api.github.com/repos/crazy-max/test-docker-action/tags", + "teams_url": "https://api.github.com/repos/crazy-max/test-docker-action/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}", + "updated_at": "2025-08-12T06:56:46Z", + "url": "https://api.github.com/repos/crazy-max/test-docker-action", + "use_squash_pr_title_as_default": false, + "visibility": "private", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + } + }, + "html_url": "https://github.com/docker/test-docker-action/pull/55", + "id": 2943619700, + "issue_url": "https://api.github.com/repos/docker/test-docker-action/issues/55", + "labels": [], + "locked": false, + "maintainer_can_modify": true, + "merge_commit_sha": "185f792b68ccf87b60a6260f08f247c8fa209488", + "mergeable": null, + "mergeable_state": "unknown", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOEQjNNc6vdBJ0", + "number": 55, + "patch_url": "https://github.com/docker/test-docker-action/pull/55.patch", + "rebaseable": null, + "requested_reviewers": [], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}", + "review_comments": 0, + "review_comments_url": "https://api.github.com/repos/docker/test-docker-action/pulls/55/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "title": "ghutil", + "updated_at": "2025-10-24T08:27:14Z", + "url": "https://api.github.com/repos/docker/test-docker-action/pulls/55", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url": "https://github.com/docker/test-docker-action.git", + "collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at": "2020-08-07T09:23:00Z", + "custom_properties": {}, + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments", + "description": "Test \"Docker\" Actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url": "https://api.github.com/repos/docker/test-docker-action/events", + "fork": false, + "forks": 1, + "forks_count": 1, + "forks_url": "https://api.github.com/repos/docker/test-docker-action/forks", + "full_name": "docker/test-docker-action", + "git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url": "git://github.com/docker/test-docker-action.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": false, + "has_wiki": false, + "homepage": "", + "hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url": "https://github.com/docker/test-docker-action", + "id": 285789493, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language": "JavaScript", + "languages_url": "https://api.github.com/repos/docker/test-docker-action/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url": null, + "name": "test-docker-action", + "node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues": 16, + "open_issues_count": 16, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url": "https://api.github.com/users/docker/events{/privacy}", + "followers_url": "https://api.github.com/users/docker/followers", + "following_url": "https://api.github.com/users/docker/following{/other_user}", + "gists_url": "https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/docker", + "id": 5429470, + "login": "docker", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url": "https://api.github.com/users/docker/orgs", + "received_events_url": "https://api.github.com/users/docker/received_events", + "repos_url": "https://api.github.com/users/docker/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/docker/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/docker", + "user_view_type": "public" + }, + "private": true, + "pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at": "2025-09-29T14:04:23Z", + "releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size": 1374, + "ssh_url": "git@github.com:docker/test-docker-action.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url": "https://github.com/docker/test-docker-action", + "tags_url": "https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url": "https://api.github.com/repos/docker/test-docker-action/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at": "2025-09-29T14:04:27Z", + "url": "https://api.github.com/repos/docker/test-docker-action", + "visibility": "internal", + "watchers": 1, + "watchers_count": 1, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + } +} \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_pr_expected.json b/util/ghutil/fixtures/ghactx_pr_expected.json new file mode 100644 index 000000000..a8b5b92c9 --- /dev/null +++ b/util/ghutil/fixtures/ghactx_pr_expected.json @@ -0,0 +1,587 @@ +{ + "github_actor":"crazy-max", + "github_actor_id":"1951866", + "github_event_name":"pull_request", + "github_event_payload":{ + "action":"synchronize", + "after":"3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "before":"c89d99c85a2603825bf11a688a446cfb50488deb", + "enterprise":{ + "avatar_url":"https://avatars.githubusercontent.com/b/19176?v=4", + "created_at":"2022-12-30T23:53:17Z", + "description":null, + "html_url":"https://github.com/enterprises/docker", + "id":19176, + "name":"Docker", + "node_id":"E_kgDNSug", + "slug":"docker", + "updated_at":"2025-10-20T20:39:05Z", + "website_url":null + }, + "number":55, + "organization":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "description":"Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url":"https://api.github.com/orgs/docker/events", + "hooks_url":"https://api.github.com/orgs/docker/hooks", + "id":5429470, + "issues_url":"https://api.github.com/orgs/docker/issues", + "login":"docker", + "members_url":"https://api.github.com/orgs/docker/members{/member}", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url":"https://api.github.com/orgs/docker/public_members{/member}", + "repos_url":"https://api.github.com/orgs/docker/repos", + "url":"https://api.github.com/orgs/docker" + }, + "pull_request":{ + "_links":{ + "comments":{ + "href":"https://api.github.com/repos/docker/test-docker-action/issues/55/comments" + }, + "commits":{ + "href":"https://api.github.com/repos/docker/test-docker-action/pulls/55/commits" + }, + "html":{ + "href":"https://github.com/docker/test-docker-action/pull/55" + }, + "issue":{ + "href":"https://api.github.com/repos/docker/test-docker-action/issues/55" + }, + "review_comment":{ + "href":"https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}" + }, + "review_comments":{ + "href":"https://api.github.com/repos/docker/test-docker-action/pulls/55/comments" + }, + "self":{ + "href":"https://api.github.com/repos/docker/test-docker-action/pulls/55" + }, + "statuses":{ + "href":"https://api.github.com/repos/docker/test-docker-action/statuses/3be79a9f0a68f4a7b93c001d377d9397663f6a5f" + } + }, + "active_lock_reason":null, + "additions":25, + "assignee":null, + "assignees":[ + + ], + "author_association":"MEMBER", + "auto_merge":null, + "base":{ + "label":"docker:master", + "ref":"master", + "repo":{ + "allow_auto_merge":false, + "allow_forking":true, + "allow_merge_commit":true, + "allow_rebase_merge":true, + "allow_squash_merge":true, + "allow_update_branch":false, + "archive_url":"https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url":"https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url":"https://github.com/docker/test-docker-action.git", + "collaborators_url":"https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url":"https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url":"https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url":"https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at":"2020-08-07T09:23:00Z", + "default_branch":"master", + "delete_branch_on_merge":false, + "deployments_url":"https://api.github.com/repos/docker/test-docker-action/deployments", + "description":"Test \"Docker\" Actions", + "disabled":false, + "downloads_url":"https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url":"https://api.github.com/repos/docker/test-docker-action/events", + "fork":false, + "forks":1, + "forks_count":1, + "forks_url":"https://api.github.com/repos/docker/test-docker-action/forks", + "full_name":"docker/test-docker-action", + "git_commits_url":"https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url":"git://github.com/docker/test-docker-action.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":true, + "has_pages":false, + "has_projects":false, + "has_wiki":false, + "homepage":"", + "hooks_url":"https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url":"https://github.com/docker/test-docker-action", + "id":285789493, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url":"https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url":"https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url":"https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language":"JavaScript", + "languages_url":"https://api.github.com/repos/docker/test-docker-action/languages", + "license":{ + "key":"mit", + "name":"MIT License", + "node_id":"MDc6TGljZW5zZTEz", + "spdx_id":"MIT", + "url":"https://api.github.com/licenses/mit" + }, + "merge_commit_message":"PR_TITLE", + "merge_commit_title":"MERGE_MESSAGE", + "merges_url":"https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url":"https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url":null, + "name":"test-docker-action", + "node_id":"MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url":"https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues":16, + "open_issues_count":16, + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url":"https://api.github.com/users/docker/events{/privacy}", + "followers_url":"https://api.github.com/users/docker/followers", + "following_url":"https://api.github.com/users/docker/following{/other_user}", + "gists_url":"https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/docker", + "id":5429470, + "login":"docker", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url":"https://api.github.com/users/docker/orgs", + "received_events_url":"https://api.github.com/users/docker/received_events", + "repos_url":"https://api.github.com/users/docker/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/docker/subscriptions", + "type":"Organization", + "url":"https://api.github.com/users/docker", + "user_view_type":"public" + }, + "private":true, + "pulls_url":"https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at":"2025-09-29T14:04:23Z", + "releases_url":"https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size":1374, + "squash_merge_commit_message":"COMMIT_MESSAGES", + "squash_merge_commit_title":"COMMIT_OR_PR_TITLE", + "ssh_url":"git@github.com:docker/test-docker-action.git", + "stargazers_count":1, + "stargazers_url":"https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url":"https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url":"https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url":"https://github.com/docker/test-docker-action", + "tags_url":"https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url":"https://api.github.com/repos/docker/test-docker-action/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at":"2025-09-29T14:04:27Z", + "url":"https://api.github.com/repos/docker/test-docker-action", + "use_squash_pr_title_as_default":false, + "visibility":"internal", + "watchers":1, + "watchers_count":1, + "web_commit_signoff_required":false + }, + "sha":"231cbfa88dca156930d8e7991b6cf57bc09fd090", + "user":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url":"https://api.github.com/users/docker/events{/privacy}", + "followers_url":"https://api.github.com/users/docker/followers", + "following_url":"https://api.github.com/users/docker/following{/other_user}", + "gists_url":"https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/docker", + "id":5429470, + "login":"docker", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url":"https://api.github.com/users/docker/orgs", + "received_events_url":"https://api.github.com/users/docker/received_events", + "repos_url":"https://api.github.com/users/docker/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/docker/subscriptions", + "type":"Organization", + "url":"https://api.github.com/users/docker", + "user_view_type":"public" + } + }, + "body":null, + "changed_files":1, + "closed_at":null, + "comments":0, + "comments_url":"https://api.github.com/repos/docker/test-docker-action/issues/55/comments", + "commits":1, + "commits_url":"https://api.github.com/repos/docker/test-docker-action/pulls/55/commits", + "created_at":"2025-10-24T08:25:26Z", + "deletions":0, + "diff_url":"https://github.com/docker/test-docker-action/pull/55.diff", + "draft":false, + "head":{ + "label":"crazy-max:ghutil", + "ref":"ghutil", + "repo":{ + "allow_auto_merge":false, + "allow_forking":true, + "allow_merge_commit":true, + "allow_rebase_merge":true, + "allow_squash_merge":true, + "allow_update_branch":false, + "archive_url":"https://api.github.com/repos/crazy-max/test-docker-action/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/crazy-max/test-docker-action/assignees{/user}", + "blobs_url":"https://api.github.com/repos/crazy-max/test-docker-action/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/crazy-max/test-docker-action/branches{/branch}", + "clone_url":"https://github.com/crazy-max/test-docker-action.git", + "collaborators_url":"https://api.github.com/repos/crazy-max/test-docker-action/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/crazy-max/test-docker-action/comments{/number}", + "commits_url":"https://api.github.com/repos/crazy-max/test-docker-action/commits{/sha}", + "compare_url":"https://api.github.com/repos/crazy-max/test-docker-action/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/crazy-max/test-docker-action/contents/{+path}", + "contributors_url":"https://api.github.com/repos/crazy-max/test-docker-action/contributors", + "created_at":"2021-07-11T17:34:22Z", + "default_branch":"master", + "delete_branch_on_merge":false, + "deployments_url":"https://api.github.com/repos/crazy-max/test-docker-action/deployments", + "description":"Test \"Docker\" Actions", + "disabled":false, + "downloads_url":"https://api.github.com/repos/crazy-max/test-docker-action/downloads", + "events_url":"https://api.github.com/repos/crazy-max/test-docker-action/events", + "fork":true, + "forks":0, + "forks_count":0, + "forks_url":"https://api.github.com/repos/crazy-max/test-docker-action/forks", + "full_name":"crazy-max/test-docker-action", + "git_commits_url":"https://api.github.com/repos/crazy-max/test-docker-action/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/crazy-max/test-docker-action/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/crazy-max/test-docker-action/git/tags{/sha}", + "git_url":"git://github.com/crazy-max/test-docker-action.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":false, + "has_pages":false, + "has_projects":true, + "has_wiki":false, + "homepage":"", + "hooks_url":"https://api.github.com/repos/crazy-max/test-docker-action/hooks", + "html_url":"https://github.com/crazy-max/test-docker-action", + "id":385013169, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/crazy-max/test-docker-action/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/crazy-max/test-docker-action/issues/events{/number}", + "issues_url":"https://api.github.com/repos/crazy-max/test-docker-action/issues{/number}", + "keys_url":"https://api.github.com/repos/crazy-max/test-docker-action/keys{/key_id}", + "labels_url":"https://api.github.com/repos/crazy-max/test-docker-action/labels{/name}", + "language":"JavaScript", + "languages_url":"https://api.github.com/repos/crazy-max/test-docker-action/languages", + "license":{ + "key":"mit", + "name":"MIT License", + "node_id":"MDc6TGljZW5zZTEz", + "spdx_id":"MIT", + "url":"https://api.github.com/licenses/mit" + }, + "merge_commit_message":"PR_TITLE", + "merge_commit_title":"MERGE_MESSAGE", + "merges_url":"https://api.github.com/repos/crazy-max/test-docker-action/merges", + "milestones_url":"https://api.github.com/repos/crazy-max/test-docker-action/milestones{/number}", + "mirror_url":null, + "name":"test-docker-action", + "node_id":"MDEwOlJlcG9zaXRvcnkzODUwMTMxNjk=", + "notifications_url":"https://api.github.com/repos/crazy-max/test-docker-action/notifications{?since,all,participating}", + "open_issues":0, + "open_issues_count":0, + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + }, + "private":true, + "pulls_url":"https://api.github.com/repos/crazy-max/test-docker-action/pulls{/number}", + "pushed_at":"2025-10-24T08:27:13Z", + "releases_url":"https://api.github.com/repos/crazy-max/test-docker-action/releases{/id}", + "size":1078, + "squash_merge_commit_message":"COMMIT_MESSAGES", + "squash_merge_commit_title":"COMMIT_OR_PR_TITLE", + "ssh_url":"git@github.com:crazy-max/test-docker-action.git", + "stargazers_count":0, + "stargazers_url":"https://api.github.com/repos/crazy-max/test-docker-action/stargazers", + "statuses_url":"https://api.github.com/repos/crazy-max/test-docker-action/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/crazy-max/test-docker-action/subscribers", + "subscription_url":"https://api.github.com/repos/crazy-max/test-docker-action/subscription", + "svn_url":"https://github.com/crazy-max/test-docker-action", + "tags_url":"https://api.github.com/repos/crazy-max/test-docker-action/tags", + "teams_url":"https://api.github.com/repos/crazy-max/test-docker-action/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/crazy-max/test-docker-action/git/trees{/sha}", + "updated_at":"2025-08-12T06:56:46Z", + "url":"https://api.github.com/repos/crazy-max/test-docker-action", + "use_squash_pr_title_as_default":false, + "visibility":"private", + "watchers":0, + "watchers_count":0, + "web_commit_signoff_required":false + }, + "sha":"3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "user":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + } + }, + "html_url":"https://github.com/docker/test-docker-action/pull/55", + "id":2943619700, + "issue_url":"https://api.github.com/repos/docker/test-docker-action/issues/55", + "labels":[ + + ], + "locked":false, + "maintainer_can_modify":true, + "merge_commit_sha":"185f792b68ccf87b60a6260f08f247c8fa209488", + "mergeable":null, + "mergeable_state":"unknown", + "merged":false, + "merged_at":null, + "merged_by":null, + "milestone":null, + "node_id":"PR_kwDOEQjNNc6vdBJ0", + "number":55, + "patch_url":"https://github.com/docker/test-docker-action/pull/55.patch", + "rebaseable":null, + "requested_reviewers":[ + + ], + "requested_teams":[ + + ], + "review_comment_url":"https://api.github.com/repos/docker/test-docker-action/pulls/comments{/number}", + "review_comments":0, + "review_comments_url":"https://api.github.com/repos/docker/test-docker-action/pulls/55/comments", + "state":"open", + "statuses_url":"https://api.github.com/repos/docker/test-docker-action/statuses/3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "title":"ghutil", + "updated_at":"2025-10-24T08:27:14Z", + "url":"https://api.github.com/repos/docker/test-docker-action/pulls/55", + "user":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + } + }, + "repository":{ + "allow_forking":true, + "archive_url":"https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url":"https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url":"https://github.com/docker/test-docker-action.git", + "collaborators_url":"https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url":"https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url":"https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url":"https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at":"2020-08-07T09:23:00Z", + "custom_properties":{ + + }, + "default_branch":"master", + "deployments_url":"https://api.github.com/repos/docker/test-docker-action/deployments", + "description":"Test \"Docker\" Actions", + "disabled":false, + "downloads_url":"https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url":"https://api.github.com/repos/docker/test-docker-action/events", + "fork":false, + "forks":1, + "forks_count":1, + "forks_url":"https://api.github.com/repos/docker/test-docker-action/forks", + "full_name":"docker/test-docker-action", + "git_commits_url":"https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url":"git://github.com/docker/test-docker-action.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":true, + "has_pages":false, + "has_projects":false, + "has_wiki":false, + "homepage":"", + "hooks_url":"https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url":"https://github.com/docker/test-docker-action", + "id":285789493, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url":"https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url":"https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url":"https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language":"JavaScript", + "languages_url":"https://api.github.com/repos/docker/test-docker-action/languages", + "license":{ + "key":"mit", + "name":"MIT License", + "node_id":"MDc6TGljZW5zZTEz", + "spdx_id":"MIT", + "url":"https://api.github.com/licenses/mit" + }, + "merges_url":"https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url":"https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url":null, + "name":"test-docker-action", + "node_id":"MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url":"https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues":16, + "open_issues_count":16, + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "events_url":"https://api.github.com/users/docker/events{/privacy}", + "followers_url":"https://api.github.com/users/docker/followers", + "following_url":"https://api.github.com/users/docker/following{/other_user}", + "gists_url":"https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/docker", + "id":5429470, + "login":"docker", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url":"https://api.github.com/users/docker/orgs", + "received_events_url":"https://api.github.com/users/docker/received_events", + "repos_url":"https://api.github.com/users/docker/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/docker/subscriptions", + "type":"Organization", + "url":"https://api.github.com/users/docker", + "user_view_type":"public" + }, + "private":true, + "pulls_url":"https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at":"2025-09-29T14:04:23Z", + "releases_url":"https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size":1374, + "ssh_url":"git@github.com:docker/test-docker-action.git", + "stargazers_count":1, + "stargazers_url":"https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url":"https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url":"https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url":"https://github.com/docker/test-docker-action", + "tags_url":"https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url":"https://api.github.com/repos/docker/test-docker-action/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at":"2025-09-29T14:04:27Z", + "url":"https://api.github.com/repos/docker/test-docker-action", + "visibility":"internal", + "watchers":1, + "watchers_count":1, + "web_commit_signoff_required":false + }, + "sender":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + } + }, + "github_job":"ghutil", + "github_ref":"refs/pull/55/merge", + "github_ref_name":"55/merge", + "github_ref_protected":"false", + "github_ref_type":"branch", + "github_repository":"docker/test-docker-action", + "github_repository_id":"285789493", + "github_repository_owner":"docker", + "github_repository_owner_id":"5429470", + "github_run_attempt":"1", + "github_run_id":"18774179609", + "github_run_number":"2", + "github_runner_arch":"X64", + "github_runner_environment":"github-hosted", + "github_runner_image_os":"ubuntu24", + "github_runner_image_version":"20250929.60.1", + "github_runner_name":"GitHub Actions 1002237010", + "github_runner_os":"Linux", + "github_runner_tracking_id":"github_aef5ac41-9cf7-4195-9da9-851d8b29e68e", + "github_server_url":"https://github.com", + "github_triggering_actor":"crazy-max", + "github_workflow":"ghutil", + "github_workflow_ref":"docker/test-docker-action/.github/workflows/ghutil.yml@refs/pull/55/merge", + "github_workflow_sha":"198c644a687204e604c8476ad23d7d5bbb0dc221" +} \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_push.env b/util/ghutil/fixtures/ghactx_push.env new file mode 100644 index 000000000..56d989ccb --- /dev/null +++ b/util/ghutil/fixtures/ghactx_push.env @@ -0,0 +1,106 @@ +ACCEPT_EULA=Y +ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=/opt/actionarchivecache +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache +ANDROID_HOME=/usr/local/lib/android/sdk +ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/28.2.13676358 +ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_SDK_ROOT=/usr/local/lib/android/sdk +ANT_HOME=/usr/share/ant +AZURE_EXTENSION_DIR=/opt/az/azcliextensions +BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +CHROMEWEBDRIVER=/usr/local/share/chromedriver-linux64 +CHROME_BIN=/usr/bin/google-chrome +CI=true +CONDA=/usr/share/miniconda +DEBIAN_FRONTEND=noninteractive +DOTNET_MULTILEVEL_LOOKUP=0 +DOTNET_NOLOGO=1 +DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +EDGEWEBDRIVER=/usr/local/share/edge_driver +ENABLE_RUNNER_TRACING=true +GECKOWEBDRIVER=/usr/local/share/gecko_driver +GHCUP_INSTALL_BASE_PREFIX=/usr/local +GITHUB_ACTION=__run +GITHUB_ACTIONS=true +GITHUB_ACTION_REF= +GITHUB_ACTION_REPOSITORY= +GITHUB_ACTOR=crazy-max +GITHUB_ACTOR_ID=1951866 +GITHUB_API_URL=https://api.github.com +GITHUB_BASE_REF= +GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_8c7a007e-3ee1-4a13-81b8-f9a4e54c4d13 +GITHUB_EVENT_NAME=push +GITHUB_EVENT_PATH=./fixtures/ghactx_push_event.json +GITHUB_GRAPHQL_URL=https://api.github.com/graphql +GITHUB_HEAD_REF= +GITHUB_JOB=ghutil +GITHUB_OUTPUT=/home/runner/work/_temp/_runner_file_commands/set_output_8c7a007e-3ee1-4a13-81b8-f9a4e54c4d13 +GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_8c7a007e-3ee1-4a13-81b8-f9a4e54c4d13 +GITHUB_REF=refs/heads/master +GITHUB_REF_NAME=master +GITHUB_REF_PROTECTED=false +GITHUB_REF_TYPE=branch +GITHUB_REPOSITORY=docker/test-docker-action +GITHUB_REPOSITORY_ID=285789493 +GITHUB_REPOSITORY_OWNER=docker +GITHUB_REPOSITORY_OWNER_ID=5429470 +GITHUB_RETENTION_DAYS=90 +GITHUB_RUN_ATTEMPT=1 +GITHUB_RUN_ID=18774637729 +GITHUB_RUN_NUMBER=3 +GITHUB_SERVER_URL=https://github.com +GITHUB_SHA=42f57536c4a55a4723772a03ead9da2940abb3d6 +GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_8c7a007e-3ee1-4a13-81b8-f9a4e54c4d13 +GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_8c7a007e-3ee1-4a13-81b8-f9a4e54c4d13 +GITHUB_TRIGGERING_ACTOR=crazy-max +GITHUB_WORKFLOW=ghutil +GITHUB_WORKFLOW_REF=docker/test-docker-action/.github/workflows/ghutil.yml@refs/heads/master +GITHUB_WORKFLOW_SHA=42f57536c4a55a4723772a03ead9da2940abb3d6 +GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action +GOROOT_1_22_X64=/opt/hostedtoolcache/go/1.22.12/x64 +GOROOT_1_23_X64=/opt/hostedtoolcache/go/1.23.12/x64 +GOROOT_1_24_X64=/opt/hostedtoolcache/go/1.24.7/x64 +GRADLE_HOME=/usr/share/gradle-9.1.0 +HOME=/home/runner +HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650 +HOMEBREW_NO_AUTO_UPDATE=1 +INVOCATION_ID=46642583e47d408d8b503e09ee054ce8 +ImageOS=ubuntu24 +ImageVersion=20250929.60.1 +JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_11_X64=/usr/lib/jvm/temurin-11-jdk-amd64 +JAVA_HOME_17_X64=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_21_X64=/usr/lib/jvm/temurin-21-jdk-amd64 +JAVA_HOME_25_X64=/usr/lib/jvm/temurin-25-jdk-amd64 +JAVA_HOME_8_X64=/usr/lib/jvm/temurin-8-jdk-amd64 +JOURNAL_STREAM=9:12559 +LANG=C.UTF-8 +LOGNAME=runner +MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/hosted-compute-agent.service/memory.pressure +MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= +NVM_DIR=/home/runner/.nvm +PATH=/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin +PIPX_BIN_DIR=/opt/pipx_bin +PIPX_HOME=/opt/pipx +POWERSHELL_DISTRIBUTION_CHANNEL=GitHub-Actions-ubuntu24 +RUNNER_ARCH=X64 +RUNNER_ENVIRONMENT=github-hosted +RUNNER_NAME=GitHub Actions 1002237537 +RUNNER_OS=Linux +RUNNER_TEMP=/home/runner/work/_temp +RUNNER_TOOL_CACHE=/opt/hostedtoolcache +RUNNER_TRACKING_ID=github_a790683c-a332-45df-b720-24d8d022bfc7 +RUNNER_WORKSPACE=/home/runner/work/test-docker-action +SELENIUM_JAR_PATH=/usr/share/java/selenium-server.jar +SGX_AESM_ADDR=1 +SHELL=/bin/bash +SHLVL=1 +SWIFT_PATH=/usr/share/swift/usr/bin +SYSTEMD_EXEC_PID=1751 +USER=runner +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +XDG_CONFIG_HOME=/home/runner/.config +XDG_RUNTIME_DIR=/run/user/1001 +_=/usr/bin/env \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_push_event.json b/util/ghutil/fixtures/ghactx_push_event.json new file mode 100644 index 000000000..eabd6f690 --- /dev/null +++ b/util/ghutil/fixtures/ghactx_push_event.json @@ -0,0 +1,230 @@ +{ + "after": "42f57536c4a55a4723772a03ead9da2940abb3d6", + "base_ref": null, + "before": "231cbfa88dca156930d8e7991b6cf57bc09fd090", + "commits": [ + { + "author": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "CrazyMax", + "username": "crazy-max" + }, + "committer": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "CrazyMax", + "username": "crazy-max" + }, + "distinct": false, + "id": "3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "message": "ghutil", + "timestamp": "2025-10-24T10:27:10+02:00", + "tree_id": "134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url": "https://github.com/docker/test-docker-action/commit/3be79a9f0a68f4a7b93c001d377d9397663f6a5f" + }, + { + "author": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "CrazyMax", + "username": "crazy-max" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "42f57536c4a55a4723772a03ead9da2940abb3d6", + "message": "Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp": "2025-10-24T10:46:33+02:00", + "tree_id": "134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url": "https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + } + ], + "compare": "https://github.com/docker/test-docker-action/compare/231cbfa88dca...42f57536c4a5", + "created": false, + "deleted": false, + "enterprise": { + "avatar_url": "https://avatars.githubusercontent.com/b/19176?v=4", + "created_at": "2022-12-30T23:53:17Z", + "description": null, + "html_url": "https://github.com/enterprises/docker", + "id": 19176, + "name": "Docker", + "node_id": "E_kgDNSug", + "slug": "docker", + "updated_at": "2025-10-20T20:39:05Z", + "website_url": null + }, + "forced": false, + "head_commit": { + "author": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "CrazyMax", + "username": "crazy-max" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "42f57536c4a55a4723772a03ead9da2940abb3d6", + "message": "Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp": "2025-10-24T10:46:33+02:00", + "tree_id": "134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url": "https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + }, + "organization": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url": "https://api.github.com/orgs/docker/events", + "hooks_url": "https://api.github.com/orgs/docker/hooks", + "id": 5429470, + "issues_url": "https://api.github.com/orgs/docker/issues", + "login": "docker", + "members_url": "https://api.github.com/orgs/docker/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url": "https://api.github.com/orgs/docker/public_members{/member}", + "repos_url": "https://api.github.com/orgs/docker/repos", + "url": "https://api.github.com/orgs/docker" + }, + "pusher": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "crazy-max" + }, + "ref": "refs/heads/master", + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url": "https://github.com/docker/test-docker-action.git", + "collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at": 1596792180, + "custom_properties": {}, + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments", + "description": "Test \"Docker\" Actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url": "https://api.github.com/repos/docker/test-docker-action/events", + "fork": false, + "forks": 1, + "forks_count": 1, + "forks_url": "https://api.github.com/repos/docker/test-docker-action/forks", + "full_name": "docker/test-docker-action", + "git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url": "git://github.com/docker/test-docker-action.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": false, + "has_wiki": false, + "homepage": "", + "hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url": "https://github.com/docker/test-docker-action", + "id": 285789493, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language": "JavaScript", + "languages_url": "https://api.github.com/repos/docker/test-docker-action/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "master_branch": "master", + "merges_url": "https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url": null, + "name": "test-docker-action", + "node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues": 15, + "open_issues_count": 15, + "organization": "docker", + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "email": "github@docker.com", + "events_url": "https://api.github.com/users/docker/events{/privacy}", + "followers_url": "https://api.github.com/users/docker/followers", + "following_url": "https://api.github.com/users/docker/following{/other_user}", + "gists_url": "https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/docker", + "id": 5429470, + "login": "docker", + "name": "docker", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url": "https://api.github.com/users/docker/orgs", + "received_events_url": "https://api.github.com/users/docker/received_events", + "repos_url": "https://api.github.com/users/docker/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/docker/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/docker", + "user_view_type": "public" + }, + "private": true, + "pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at": 1761295593, + "releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size": 1374, + "ssh_url": "git@github.com:docker/test-docker-action.git", + "stargazers": 1, + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url": "https://github.com/docker/test-docker-action", + "tags_url": "https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url": "https://api.github.com/repos/docker/test-docker-action/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at": "2025-09-29T14:04:27Z", + "url": "https://api.github.com/repos/docker/test-docker-action", + "visibility": "internal", + "watchers": 1, + "watchers_count": 1, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + } +} \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_push_expected.json b/util/ghutil/fixtures/ghactx_push_expected.json new file mode 100644 index 000000000..c3e141dbe --- /dev/null +++ b/util/ghutil/fixtures/ghactx_push_expected.json @@ -0,0 +1,263 @@ +{ + "github_actor":"crazy-max", + "github_actor_id":"1951866", + "github_event_name":"push", + "github_event_payload":{ + "after":"42f57536c4a55a4723772a03ead9da2940abb3d6", + "base_ref":null, + "before":"231cbfa88dca156930d8e7991b6cf57bc09fd090", + "commits":[ + { + "author":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"CrazyMax", + "username":"crazy-max" + }, + "committer":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"CrazyMax", + "username":"crazy-max" + }, + "distinct":false, + "id":"3be79a9f0a68f4a7b93c001d377d9397663f6a5f", + "message":"ghutil", + "timestamp":"2025-10-24T10:27:10+02:00", + "tree_id":"134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url":"https://github.com/docker/test-docker-action/commit/3be79a9f0a68f4a7b93c001d377d9397663f6a5f" + }, + { + "author":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"CrazyMax", + "username":"crazy-max" + }, + "committer":{ + "email":"noreply@github.com", + "name":"GitHub", + "username":"web-flow" + }, + "distinct":true, + "id":"42f57536c4a55a4723772a03ead9da2940abb3d6", + "message":"Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp":"2025-10-24T10:46:33+02:00", + "tree_id":"134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url":"https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + } + ], + "compare":"https://github.com/docker/test-docker-action/compare/231cbfa88dca...42f57536c4a5", + "created":false, + "deleted":false, + "enterprise":{ + "avatar_url":"https://avatars.githubusercontent.com/b/19176?v=4", + "created_at":"2022-12-30T23:53:17Z", + "description":null, + "html_url":"https://github.com/enterprises/docker", + "id":19176, + "name":"Docker", + "node_id":"E_kgDNSug", + "slug":"docker", + "updated_at":"2025-10-20T20:39:05Z", + "website_url":null + }, + "forced":false, + "head_commit":{ + "author":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"CrazyMax", + "username":"crazy-max" + }, + "committer":{ + "email":"noreply@github.com", + "name":"GitHub", + "username":"web-flow" + }, + "distinct":true, + "id":"42f57536c4a55a4723772a03ead9da2940abb3d6", + "message":"Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp":"2025-10-24T10:46:33+02:00", + "tree_id":"134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url":"https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + }, + "organization":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "description":"Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url":"https://api.github.com/orgs/docker/events", + "hooks_url":"https://api.github.com/orgs/docker/hooks", + "id":5429470, + "issues_url":"https://api.github.com/orgs/docker/issues", + "login":"docker", + "members_url":"https://api.github.com/orgs/docker/members{/member}", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url":"https://api.github.com/orgs/docker/public_members{/member}", + "repos_url":"https://api.github.com/orgs/docker/repos", + "url":"https://api.github.com/orgs/docker" + }, + "pusher":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"crazy-max" + }, + "ref":"refs/heads/master", + "repository":{ + "allow_forking":true, + "archive_url":"https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url":"https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url":"https://github.com/docker/test-docker-action.git", + "collaborators_url":"https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url":"https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url":"https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url":"https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at":1596792180, + "custom_properties":{ + + }, + "default_branch":"master", + "deployments_url":"https://api.github.com/repos/docker/test-docker-action/deployments", + "description":"Test \"Docker\" Actions", + "disabled":false, + "downloads_url":"https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url":"https://api.github.com/repos/docker/test-docker-action/events", + "fork":false, + "forks":1, + "forks_count":1, + "forks_url":"https://api.github.com/repos/docker/test-docker-action/forks", + "full_name":"docker/test-docker-action", + "git_commits_url":"https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url":"git://github.com/docker/test-docker-action.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":true, + "has_pages":false, + "has_projects":false, + "has_wiki":false, + "homepage":"", + "hooks_url":"https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url":"https://github.com/docker/test-docker-action", + "id":285789493, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url":"https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url":"https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url":"https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language":"JavaScript", + "languages_url":"https://api.github.com/repos/docker/test-docker-action/languages", + "license":{ + "key":"mit", + "name":"MIT License", + "node_id":"MDc6TGljZW5zZTEz", + "spdx_id":"MIT", + "url":"https://api.github.com/licenses/mit" + }, + "master_branch":"master", + "merges_url":"https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url":"https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url":null, + "name":"test-docker-action", + "node_id":"MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url":"https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues":15, + "open_issues_count":15, + "organization":"docker", + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "email":"github@docker.com", + "events_url":"https://api.github.com/users/docker/events{/privacy}", + "followers_url":"https://api.github.com/users/docker/followers", + "following_url":"https://api.github.com/users/docker/following{/other_user}", + "gists_url":"https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/docker", + "id":5429470, + "login":"docker", + "name":"docker", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url":"https://api.github.com/users/docker/orgs", + "received_events_url":"https://api.github.com/users/docker/received_events", + "repos_url":"https://api.github.com/users/docker/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/docker/subscriptions", + "type":"Organization", + "url":"https://api.github.com/users/docker", + "user_view_type":"public" + }, + "private":true, + "pulls_url":"https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at":1761295593, + "releases_url":"https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size":1374, + "ssh_url":"git@github.com:docker/test-docker-action.git", + "stargazers":1, + "stargazers_count":1, + "stargazers_url":"https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url":"https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url":"https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url":"https://github.com/docker/test-docker-action", + "tags_url":"https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url":"https://api.github.com/repos/docker/test-docker-action/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at":"2025-09-29T14:04:27Z", + "url":"https://api.github.com/repos/docker/test-docker-action", + "visibility":"internal", + "watchers":1, + "watchers_count":1, + "web_commit_signoff_required":false + }, + "sender":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + } + }, + "github_job":"ghutil", + "github_ref":"refs/heads/master", + "github_ref_name":"master", + "github_ref_protected":"false", + "github_ref_type":"branch", + "github_repository":"docker/test-docker-action", + "github_repository_id":"285789493", + "github_repository_owner":"docker", + "github_repository_owner_id":"5429470", + "github_run_attempt":"1", + "github_run_id":"18774637729", + "github_run_number":"3", + "github_runner_arch":"X64", + "github_runner_environment":"github-hosted", + "github_runner_image_os":"ubuntu24", + "github_runner_image_version":"20250929.60.1", + "github_runner_name":"GitHub Actions 1002237537", + "github_runner_os":"Linux", + "github_runner_tracking_id":"github_a790683c-a332-45df-b720-24d8d022bfc7", + "github_server_url":"https://github.com", + "github_triggering_actor":"crazy-max", + "github_workflow":"ghutil", + "github_workflow_ref":"docker/test-docker-action/.github/workflows/ghutil.yml@refs/heads/master", + "github_workflow_sha":"42f57536c4a55a4723772a03ead9da2940abb3d6" +} \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_tag.env b/util/ghutil/fixtures/ghactx_tag.env new file mode 100644 index 000000000..12c4ff59c --- /dev/null +++ b/util/ghutil/fixtures/ghactx_tag.env @@ -0,0 +1,106 @@ +ACCEPT_EULA=Y +ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=/opt/actionarchivecache +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache +ANDROID_HOME=/usr/local/lib/android/sdk +ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/28.2.13676358 +ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.3.13750724 +ANDROID_SDK_ROOT=/usr/local/lib/android/sdk +ANT_HOME=/usr/share/ant +AZURE_EXTENSION_DIR=/opt/az/azcliextensions +BOOTSTRAP_HASKELL_NONINTERACTIVE=1 +CHROMEWEBDRIVER=/usr/local/share/chromedriver-linux64 +CHROME_BIN=/usr/bin/google-chrome +CI=true +CONDA=/usr/share/miniconda +DEBIAN_FRONTEND=noninteractive +DOTNET_MULTILEVEL_LOOKUP=0 +DOTNET_NOLOGO=1 +DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +EDGEWEBDRIVER=/usr/local/share/edge_driver +ENABLE_RUNNER_TRACING=true +GECKOWEBDRIVER=/usr/local/share/gecko_driver +GHCUP_INSTALL_BASE_PREFIX=/usr/local +GITHUB_ACTION=__run +GITHUB_ACTIONS=true +GITHUB_ACTION_REF= +GITHUB_ACTION_REPOSITORY= +GITHUB_ACTOR=crazy-max +GITHUB_ACTOR_ID=1951866 +GITHUB_API_URL=https://api.github.com +GITHUB_BASE_REF= +GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_de9781d2-4b3b-4757-b530-2064deb19c41 +GITHUB_EVENT_NAME=push +GITHUB_EVENT_PATH=./fixtures/ghactx_tag_event.json +GITHUB_GRAPHQL_URL=https://api.github.com/graphql +GITHUB_HEAD_REF= +GITHUB_JOB=ghutil +GITHUB_OUTPUT=/home/runner/work/_temp/_runner_file_commands/set_output_de9781d2-4b3b-4757-b530-2064deb19c41 +GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_de9781d2-4b3b-4757-b530-2064deb19c41 +GITHUB_REF=refs/tags/v2.8.0 +GITHUB_REF_NAME=v2.8.0 +GITHUB_REF_PROTECTED=false +GITHUB_REF_TYPE=tag +GITHUB_REPOSITORY=docker/test-docker-action +GITHUB_REPOSITORY_ID=285789493 +GITHUB_REPOSITORY_OWNER=docker +GITHUB_REPOSITORY_OWNER_ID=5429470 +GITHUB_RETENTION_DAYS=90 +GITHUB_RUN_ATTEMPT=1 +GITHUB_RUN_ID=18774710377 +GITHUB_RUN_NUMBER=4 +GITHUB_SERVER_URL=https://github.com +GITHUB_SHA=42f57536c4a55a4723772a03ead9da2940abb3d6 +GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_de9781d2-4b3b-4757-b530-2064deb19c41 +GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_de9781d2-4b3b-4757-b530-2064deb19c41 +GITHUB_TRIGGERING_ACTOR=crazy-max +GITHUB_WORKFLOW=ghutil +GITHUB_WORKFLOW_REF=docker/test-docker-action/.github/workflows/ghutil.yml@refs/tags/v2.8.0 +GITHUB_WORKFLOW_SHA=42f57536c4a55a4723772a03ead9da2940abb3d6 +GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action +GOROOT_1_22_X64=/opt/hostedtoolcache/go/1.22.12/x64 +GOROOT_1_23_X64=/opt/hostedtoolcache/go/1.23.12/x64 +GOROOT_1_24_X64=/opt/hostedtoolcache/go/1.24.7/x64 +GRADLE_HOME=/usr/share/gradle-9.1.0 +HOME=/home/runner +HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650 +HOMEBREW_NO_AUTO_UPDATE=1 +INVOCATION_ID=cdb06b30bfa146fab2970772a489c540 +ImageOS=ubuntu24 +ImageVersion=20250929.60.1 +JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_11_X64=/usr/lib/jvm/temurin-11-jdk-amd64 +JAVA_HOME_17_X64=/usr/lib/jvm/temurin-17-jdk-amd64 +JAVA_HOME_21_X64=/usr/lib/jvm/temurin-21-jdk-amd64 +JAVA_HOME_25_X64=/usr/lib/jvm/temurin-25-jdk-amd64 +JAVA_HOME_8_X64=/usr/lib/jvm/temurin-8-jdk-amd64 +JOURNAL_STREAM=9:12793 +LANG=C.UTF-8 +LOGNAME=runner +MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/hosted-compute-agent.service/memory.pressure +MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= +NVM_DIR=/home/runner/.nvm +PATH=/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin +PIPX_BIN_DIR=/opt/pipx_bin +PIPX_HOME=/opt/pipx +POWERSHELL_DISTRIBUTION_CHANNEL=GitHub-Actions-ubuntu24 +RUNNER_ARCH=X64 +RUNNER_ENVIRONMENT=github-hosted +RUNNER_NAME=GitHub Actions 1002237589 +RUNNER_OS=Linux +RUNNER_TEMP=/home/runner/work/_temp +RUNNER_TOOL_CACHE=/opt/hostedtoolcache +RUNNER_TRACKING_ID=github_dffa1c6c-c3b7-42d8-873e-a83b52f27716 +RUNNER_WORKSPACE=/home/runner/work/test-docker-action +SELENIUM_JAR_PATH=/usr/share/java/selenium-server.jar +SGX_AESM_ADDR=1 +SHELL=/bin/bash +SHLVL=1 +SWIFT_PATH=/usr/share/swift/usr/bin +SYSTEMD_EXEC_PID=1746 +USER=runner +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +XDG_CONFIG_HOME=/home/runner/.config +XDG_RUNTIME_DIR=/run/user/1001 +_=/usr/bin/env \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_tag_event.json b/util/ghutil/fixtures/ghactx_tag_event.json new file mode 100644 index 000000000..d8b93d099 --- /dev/null +++ b/util/ghutil/fixtures/ghactx_tag_event.json @@ -0,0 +1,193 @@ +{ + "after": "42f57536c4a55a4723772a03ead9da2940abb3d6", + "base_ref": "refs/heads/master", + "before": "0000000000000000000000000000000000000000", + "commits": [], + "compare": "https://github.com/docker/test-docker-action/compare/v2.8.0", + "created": true, + "deleted": false, + "enterprise": { + "avatar_url": "https://avatars.githubusercontent.com/b/19176?v=4", + "created_at": "2022-12-30T23:53:17Z", + "description": null, + "html_url": "https://github.com/enterprises/docker", + "id": 19176, + "name": "Docker", + "node_id": "E_kgDNSug", + "slug": "docker", + "updated_at": "2025-10-20T20:39:05Z", + "website_url": null + }, + "forced": false, + "head_commit": { + "author": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "CrazyMax", + "username": "crazy-max" + }, + "committer": { + "email": "noreply@github.com", + "name": "GitHub", + "username": "web-flow" + }, + "distinct": true, + "id": "42f57536c4a55a4723772a03ead9da2940abb3d6", + "message": "Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp": "2025-10-24T10:46:33+02:00", + "tree_id": "134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url": "https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + }, + "organization": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "description": "Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url": "https://api.github.com/orgs/docker/events", + "hooks_url": "https://api.github.com/orgs/docker/hooks", + "id": 5429470, + "issues_url": "https://api.github.com/orgs/docker/issues", + "login": "docker", + "members_url": "https://api.github.com/orgs/docker/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url": "https://api.github.com/orgs/docker/public_members{/member}", + "repos_url": "https://api.github.com/orgs/docker/repos", + "url": "https://api.github.com/orgs/docker" + }, + "pusher": { + "email": "1951866+crazy-max@users.noreply.github.com", + "name": "crazy-max" + }, + "ref": "refs/tags/v2.8.0", + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url": "https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url": "https://github.com/docker/test-docker-action.git", + "collaborators_url": "https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url": "https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url": "https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url": "https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at": 1596792180, + "custom_properties": {}, + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/docker/test-docker-action/deployments", + "description": "Test \"Docker\" Actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url": "https://api.github.com/repos/docker/test-docker-action/events", + "fork": false, + "forks": 1, + "forks_count": 1, + "forks_url": "https://api.github.com/repos/docker/test-docker-action/forks", + "full_name": "docker/test-docker-action", + "git_commits_url": "https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url": "git://github.com/docker/test-docker-action.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": false, + "has_wiki": false, + "homepage": "", + "hooks_url": "https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url": "https://github.com/docker/test-docker-action", + "id": 285789493, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url": "https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url": "https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url": "https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language": "JavaScript", + "languages_url": "https://api.github.com/repos/docker/test-docker-action/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "master_branch": "master", + "merges_url": "https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url": "https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url": null, + "name": "test-docker-action", + "node_id": "MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url": "https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues": 15, + "open_issues_count": 15, + "organization": "docker", + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/5429470?v=4", + "email": "github@docker.com", + "events_url": "https://api.github.com/users/docker/events{/privacy}", + "followers_url": "https://api.github.com/users/docker/followers", + "following_url": "https://api.github.com/users/docker/following{/other_user}", + "gists_url": "https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/docker", + "id": 5429470, + "login": "docker", + "name": "docker", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url": "https://api.github.com/users/docker/orgs", + "received_events_url": "https://api.github.com/users/docker/received_events", + "repos_url": "https://api.github.com/users/docker/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/docker/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/docker", + "user_view_type": "public" + }, + "private": true, + "pulls_url": "https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at": 1761295781, + "releases_url": "https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size": 1374, + "ssh_url": "git@github.com:docker/test-docker-action.git", + "stargazers": 1, + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url": "https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url": "https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url": "https://github.com/docker/test-docker-action", + "tags_url": "https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url": "https://api.github.com/repos/docker/test-docker-action/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at": "2025-10-24T08:46:37Z", + "url": "https://api.github.com/repos/docker/test-docker-action", + "visibility": "internal", + "watchers": 1, + "watchers_count": 1, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url": "https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url": "https://api.github.com/users/crazy-max/followers", + "following_url": "https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url": "https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/crazy-max", + "id": 1951866, + "login": "crazy-max", + "node_id": "MDQ6VXNlcjE5NTE4NjY=", + "organizations_url": "https://api.github.com/users/crazy-max/orgs", + "received_events_url": "https://api.github.com/users/crazy-max/received_events", + "repos_url": "https://api.github.com/users/crazy-max/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/crazy-max/subscriptions", + "type": "User", + "url": "https://api.github.com/users/crazy-max", + "user_view_type": "public" + } +} \ No newline at end of file diff --git a/util/ghutil/fixtures/ghactx_tag_expected.json b/util/ghutil/fixtures/ghactx_tag_expected.json new file mode 100644 index 000000000..5174d318f --- /dev/null +++ b/util/ghutil/fixtures/ghactx_tag_expected.json @@ -0,0 +1,228 @@ +{ + "github_actor":"crazy-max", + "github_actor_id":"1951866", + "github_event_name":"push", + "github_event_payload":{ + "after":"42f57536c4a55a4723772a03ead9da2940abb3d6", + "base_ref":"refs/heads/master", + "before":"0000000000000000000000000000000000000000", + "commits":[ + + ], + "compare":"https://github.com/docker/test-docker-action/compare/v2.8.0", + "created":true, + "deleted":false, + "enterprise":{ + "avatar_url":"https://avatars.githubusercontent.com/b/19176?v=4", + "created_at":"2022-12-30T23:53:17Z", + "description":null, + "html_url":"https://github.com/enterprises/docker", + "id":19176, + "name":"Docker", + "node_id":"E_kgDNSug", + "slug":"docker", + "updated_at":"2025-10-20T20:39:05Z", + "website_url":null + }, + "forced":false, + "head_commit":{ + "author":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"CrazyMax", + "username":"crazy-max" + }, + "committer":{ + "email":"noreply@github.com", + "name":"GitHub", + "username":"web-flow" + }, + "distinct":true, + "id":"42f57536c4a55a4723772a03ead9da2940abb3d6", + "message":"Merge pull request #55 from crazy-max/ghutil\n\nghutil", + "timestamp":"2025-10-24T10:46:33+02:00", + "tree_id":"134cdd78c695edc2dacc06fa212cbe393b84b93b", + "url":"https://github.com/docker/test-docker-action/commit/42f57536c4a55a4723772a03ead9da2940abb3d6" + }, + "organization":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "description":"Docker helps developers bring their ideas to life by conquering the complexity of app development.", + "events_url":"https://api.github.com/orgs/docker/events", + "hooks_url":"https://api.github.com/orgs/docker/hooks", + "id":5429470, + "issues_url":"https://api.github.com/orgs/docker/issues", + "login":"docker", + "members_url":"https://api.github.com/orgs/docker/members{/member}", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "public_members_url":"https://api.github.com/orgs/docker/public_members{/member}", + "repos_url":"https://api.github.com/orgs/docker/repos", + "url":"https://api.github.com/orgs/docker" + }, + "pusher":{ + "email":"1951866+crazy-max@users.noreply.github.com", + "name":"crazy-max" + }, + "ref":"refs/tags/v2.8.0", + "repository":{ + "allow_forking":true, + "archive_url":"https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/docker/test-docker-action/assignees{/user}", + "blobs_url":"https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/docker/test-docker-action/branches{/branch}", + "clone_url":"https://github.com/docker/test-docker-action.git", + "collaborators_url":"https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/docker/test-docker-action/comments{/number}", + "commits_url":"https://api.github.com/repos/docker/test-docker-action/commits{/sha}", + "compare_url":"https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/docker/test-docker-action/contents/{+path}", + "contributors_url":"https://api.github.com/repos/docker/test-docker-action/contributors", + "created_at":1596792180, + "custom_properties":{ + + }, + "default_branch":"master", + "deployments_url":"https://api.github.com/repos/docker/test-docker-action/deployments", + "description":"Test \"Docker\" Actions", + "disabled":false, + "downloads_url":"https://api.github.com/repos/docker/test-docker-action/downloads", + "events_url":"https://api.github.com/repos/docker/test-docker-action/events", + "fork":false, + "forks":1, + "forks_count":1, + "forks_url":"https://api.github.com/repos/docker/test-docker-action/forks", + "full_name":"docker/test-docker-action", + "git_commits_url":"https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}", + "git_url":"git://github.com/docker/test-docker-action.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":true, + "has_pages":false, + "has_projects":false, + "has_wiki":false, + "homepage":"", + "hooks_url":"https://api.github.com/repos/docker/test-docker-action/hooks", + "html_url":"https://github.com/docker/test-docker-action", + "id":285789493, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/docker/test-docker-action/issues/events{/number}", + "issues_url":"https://api.github.com/repos/docker/test-docker-action/issues{/number}", + "keys_url":"https://api.github.com/repos/docker/test-docker-action/keys{/key_id}", + "labels_url":"https://api.github.com/repos/docker/test-docker-action/labels{/name}", + "language":"JavaScript", + "languages_url":"https://api.github.com/repos/docker/test-docker-action/languages", + "license":{ + "key":"mit", + "name":"MIT License", + "node_id":"MDc6TGljZW5zZTEz", + "spdx_id":"MIT", + "url":"https://api.github.com/licenses/mit" + }, + "master_branch":"master", + "merges_url":"https://api.github.com/repos/docker/test-docker-action/merges", + "milestones_url":"https://api.github.com/repos/docker/test-docker-action/milestones{/number}", + "mirror_url":null, + "name":"test-docker-action", + "node_id":"MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=", + "notifications_url":"https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}", + "open_issues":15, + "open_issues_count":15, + "organization":"docker", + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=4", + "email":"github@docker.com", + "events_url":"https://api.github.com/users/docker/events{/privacy}", + "followers_url":"https://api.github.com/users/docker/followers", + "following_url":"https://api.github.com/users/docker/following{/other_user}", + "gists_url":"https://api.github.com/users/docker/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/docker", + "id":5429470, + "login":"docker", + "name":"docker", + "node_id":"MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=", + "organizations_url":"https://api.github.com/users/docker/orgs", + "received_events_url":"https://api.github.com/users/docker/received_events", + "repos_url":"https://api.github.com/users/docker/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/docker/subscriptions", + "type":"Organization", + "url":"https://api.github.com/users/docker", + "user_view_type":"public" + }, + "private":true, + "pulls_url":"https://api.github.com/repos/docker/test-docker-action/pulls{/number}", + "pushed_at":1761295781, + "releases_url":"https://api.github.com/repos/docker/test-docker-action/releases{/id}", + "size":1374, + "ssh_url":"git@github.com:docker/test-docker-action.git", + "stargazers":1, + "stargazers_count":1, + "stargazers_url":"https://api.github.com/repos/docker/test-docker-action/stargazers", + "statuses_url":"https://api.github.com/repos/docker/test-docker-action/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/docker/test-docker-action/subscribers", + "subscription_url":"https://api.github.com/repos/docker/test-docker-action/subscription", + "svn_url":"https://github.com/docker/test-docker-action", + "tags_url":"https://api.github.com/repos/docker/test-docker-action/tags", + "teams_url":"https://api.github.com/repos/docker/test-docker-action/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}", + "updated_at":"2025-10-24T08:46:37Z", + "url":"https://api.github.com/repos/docker/test-docker-action", + "visibility":"internal", + "watchers":1, + "watchers_count":1, + "web_commit_signoff_required":false + }, + "sender":{ + "avatar_url":"https://avatars.githubusercontent.com/u/1951866?v=4", + "events_url":"https://api.github.com/users/crazy-max/events{/privacy}", + "followers_url":"https://api.github.com/users/crazy-max/followers", + "following_url":"https://api.github.com/users/crazy-max/following{/other_user}", + "gists_url":"https://api.github.com/users/crazy-max/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/crazy-max", + "id":1951866, + "login":"crazy-max", + "node_id":"MDQ6VXNlcjE5NTE4NjY=", + "organizations_url":"https://api.github.com/users/crazy-max/orgs", + "received_events_url":"https://api.github.com/users/crazy-max/received_events", + "repos_url":"https://api.github.com/users/crazy-max/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/crazy-max/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/crazy-max/subscriptions", + "type":"User", + "url":"https://api.github.com/users/crazy-max", + "user_view_type":"public" + } + }, + "github_job":"ghutil", + "github_ref":"refs/tags/v2.8.0", + "github_ref_name":"v2.8.0", + "github_ref_protected":"false", + "github_ref_type":"tag", + "github_repository":"docker/test-docker-action", + "github_repository_id":"285789493", + "github_repository_owner":"docker", + "github_repository_owner_id":"5429470", + "github_run_attempt":"1", + "github_run_id":"18774710377", + "github_run_number":"4", + "github_runner_arch":"X64", + "github_runner_environment":"github-hosted", + "github_runner_image_os":"ubuntu24", + "github_runner_image_version":"20250929.60.1", + "github_runner_name":"GitHub Actions 1002237589", + "github_runner_os":"Linux", + "github_runner_tracking_id":"github_dffa1c6c-c3b7-42d8-873e-a83b52f27716", + "github_server_url":"https://github.com", + "github_triggering_actor":"crazy-max", + "github_workflow":"ghutil", + "github_workflow_ref":"docker/test-docker-action/.github/workflows/ghutil.yml@refs/tags/v2.8.0", + "github_workflow_sha":"42f57536c4a55a4723772a03ead9da2940abb3d6" +} \ No newline at end of file diff --git a/util/ghutil/ghutil.go b/util/ghutil/ghutil.go new file mode 100644 index 000000000..e1ca13bfb --- /dev/null +++ b/util/ghutil/ghutil.go @@ -0,0 +1,145 @@ +package ghutil + +import ( + "encoding/json" + "os" + "strconv" + + "github.com/pkg/errors" +) + +func GithubActionsContext() ([]byte, error) { + m := make(map[string]any) + + // Detect if running in GitHub Actions + // "GITHUB_ACTIONS": "true" + if gha, ok := os.LookupEnv("GITHUB_ACTIONS"); !ok { + return nil, nil + } else if v, _ := strconv.ParseBool(gha); !v { + return nil, nil + } + + // Skip if required event information is not available + githubEventName := os.Getenv("GITHUB_EVENT_NAME") + githubEventPath := os.Getenv("GITHUB_EVENT_PATH") + if githubEventName == "" || githubEventPath == "" { + return nil, nil + } + + // GitHub event + // "GITHUB_EVENT_NAME": "push" + // "GITHUB_EVENT_PATH": "/home/runner/work/_temp/_github_workflow/event.json" + m["github_event_name"] = githubEventName + dt, err := os.ReadFile(githubEventPath) + if err != nil { + return nil, errors.Wrapf(err, "failed to read GITHUB_EVENT_PATH %q", githubEventPath) + } + var evt map[string]any + if err := json.Unmarshal(dt, &evt); err != nil { + return nil, errors.Wrapf(err, "failed to unmarshal GitHub event payload from %q", githubEventPath) + } + m["github_event_payload"] = evt + + // GitHub actor + // "GITHUB_ACTOR": "crazy-max" + // "GITHUB_ACTOR_ID": "1951866" + // "GITHUB_TRIGGERING_ACTOR": "crazy-max" + githubActor := os.Getenv("GITHUB_ACTOR") + githubActorID := os.Getenv("GITHUB_ACTOR_ID") + githubTriggeringActor := os.Getenv("GITHUB_TRIGGERING_ACTOR") + if githubActor != "" && githubActorID != "" && githubTriggeringActor != "" { + m["github_actor"] = githubActor + m["github_actor_id"] = githubActorID + m["github_triggering_actor"] = githubTriggeringActor + } + + // GitHub ref + // "GITHUB_REF": "refs/heads/master" + // "GITHUB_REF_NAME": "master" + // "GITHUB_REF_PROTECTED": "true" + // "GITHUB_REF_TYPE": "branch" + githubRef := os.Getenv("GITHUB_REF") + githubRefName := os.Getenv("GITHUB_REF_NAME") + githubRefProtected := os.Getenv("GITHUB_REF_PROTECTED") + githubRefType := os.Getenv("GITHUB_REF_TYPE") + if githubRef != "" && githubRefName != "" && githubRefProtected != "" && githubRefType != "" { + m["github_ref"] = githubRef + m["github_ref_name"] = githubRefName + m["github_ref_protected"] = githubRefProtected + m["github_ref_type"] = githubRefType + } + + // GitHub repository + // "GITHUB_REPOSITORY": "crazy-max/ghaction-dump-context" + // "GITHUB_REPOSITORY_ID": "286865579" + // "GITHUB_REPOSITORY_OWNER": "crazy-max" + // "GITHUB_REPOSITORY_OWNER_ID": "1951866" + githubRepository := os.Getenv("GITHUB_REPOSITORY") + githubRepositoryID := os.Getenv("GITHUB_REPOSITORY_ID") + githubRepositoryOwner := os.Getenv("GITHUB_REPOSITORY_OWNER") + githubRepositoryOwnerID := os.Getenv("GITHUB_REPOSITORY_OWNER_ID") + if githubRepository != "" && githubRepositoryID != "" && githubRepositoryOwner != "" && githubRepositoryOwnerID != "" { + m["github_repository"] = githubRepository + m["github_repository_id"] = githubRepositoryID + m["github_repository_owner"] = githubRepositoryOwner + m["github_repository_owner_id"] = githubRepositoryOwnerID + } + + // GitHub workflow + // "GITHUB_JOB": "dump" + // "GITHUB_RUN_ATTEMPT": "1" + // "GITHUB_RUN_ID": "18715517508" + // "GITHUB_RUN_NUMBER": "617" + // "GITHUB_SERVER_URL": "https://github.com" + // "GITHUB_WORKFLOW": "ci" + // "GITHUB_WORKFLOW_REF": "crazy-max/ghaction-dump-context/.github/workflows/ci.yml@refs/heads/master" + // "GITHUB_WORKFLOW_SHA": "391d493f5fb04040f2a2770b33f86f3f62518392" + githubJob := os.Getenv("GITHUB_JOB") + githubRunAttempt := os.Getenv("GITHUB_RUN_ATTEMPT") + githubRunID := os.Getenv("GITHUB_RUN_ID") + githubRunNumber := os.Getenv("GITHUB_RUN_NUMBER") + githubServerURL := os.Getenv("GITHUB_SERVER_URL") + githubWorkflow := os.Getenv("GITHUB_WORKFLOW") + githubWorkflowRef := os.Getenv("GITHUB_WORKFLOW_REF") + githubWorkflowSHA := os.Getenv("GITHUB_WORKFLOW_SHA") + if githubJob != "" && githubRunAttempt != "" && githubRunID != "" && githubRunNumber != "" && githubServerURL != "" && githubWorkflow != "" && githubWorkflowRef != "" && githubWorkflowSHA != "" { + m["github_job"] = githubJob + m["github_run_attempt"] = githubRunAttempt + m["github_run_id"] = githubRunID + m["github_run_number"] = githubRunNumber + m["github_server_url"] = githubServerURL + m["github_workflow"] = githubWorkflow + m["github_workflow_ref"] = githubWorkflowRef + m["github_workflow_sha"] = githubWorkflowSHA + } + + // GitHub runner information + // "ImageOS": "ubuntu24" + // "ImageVersion": "20250929.60.1" + // "RUNNER_ARCH": "X64" + // "RUNNER_ENVIRONMENT": "github-hosted" + // "RUNNER_NAME": "GitHub Actions 1000091440" + // "RUNNER_OS": "Linux" + // "RUNNER_TEMP": "/home/runner/work/_temp" + // "RUNNER_TOOL_CACHE": "/opt/hostedtoolcache" + // "RUNNER_TRACKING_ID": "github_7bd1d852-eaeb-423f-8fa4-4ddb797c652f" + // "RUNNER_WORKSPACE": "/home/runner/work/ghaction-dump-context" + githubRunnerImageOS := os.Getenv("ImageOS") + githubRunnerImageVersion := os.Getenv("ImageVersion") + githubRunnerOS := os.Getenv("RUNNER_OS") + githubRunnerArch := os.Getenv("RUNNER_ARCH") + githubRunnerEnvironment := os.Getenv("RUNNER_ENVIRONMENT") + githubRunnerTrackingID := os.Getenv("RUNNER_TRACKING_ID") + githubRunnerName := os.Getenv("RUNNER_NAME") + if githubRunnerImageOS != "" && githubRunnerImageVersion != "" && githubRunnerOS != "" && githubRunnerArch != "" && githubRunnerEnvironment != "" && githubRunnerTrackingID != "" && githubRunnerName != "" { + m["github_runner_image_os"] = githubRunnerImageOS + m["github_runner_image_version"] = githubRunnerImageVersion + m["github_runner_os"] = githubRunnerOS + m["github_runner_arch"] = githubRunnerArch + m["github_runner_environment"] = githubRunnerEnvironment + m["github_runner_tracking_id"] = githubRunnerTrackingID + m["github_runner_name"] = githubRunnerName + } + + return json.Marshal(m) +} diff --git a/util/ghutil/ghutil_test.go b/util/ghutil/ghutil_test.go new file mode 100644 index 000000000..85005a897 --- /dev/null +++ b/util/ghutil/ghutil_test.go @@ -0,0 +1,28 @@ +package ghutil + +import ( + "os" + "path" + "testing" + + "github.com/compose-spec/compose-go/v2/dotenv" + "github.com/stretchr/testify/require" +) + +func TestGithubActionsContext(t *testing.T) { + for _, tt := range []string{"pr", "push", "tag"} { + t.Run(tt, func(t *testing.T) { + envs, err := dotenv.Read(path.Join("fixtures", "ghactx_"+tt+".env")) + require.NoError(t, err) + for k, v := range envs { + t.Setenv(k, v) + } + ghactx, err := GithubActionsContext() + require.NoError(t, err) + require.NotNil(t, ghactx) + expected, err := os.ReadFile("fixtures/ghactx_" + tt + "_expected.json") + require.NoError(t, err) + require.JSONEq(t, string(expected), string(ghactx)) + }) + } +}