[PR #889] [MERGED] feat: try to read ref and sha from event payload if available #1668

Closed
opened 2026-03-01 21:52:10 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/889
Author: @ZauberNerd
Created: 11/17/2021
Status: Merged
Merged: 1/21/2022
Merged by: @cplee

Base: masterHead: set-ref-sha


📝 Commits (1)

  • 18c3c61 feat: try to read ref and sha from event payload if available

📊 Changes

3 files changed (+247 additions, -51 deletions)

View changed files

📝 pkg/model/github_context.go (+113 -0)
pkg/model/github_context_test.go (+132 -0)
📝 pkg/runner/run_context.go (+2 -51)

📄 Description

With this change act will try to populate the githubContext.ref and
githubContext.sha with values read from the event payload.

Caveats:

  • page_build should not have a ref
  • status should not have a ref
  • registry_package should set the ref to the branch/tag but the
    payload isn't documented
  • workflow_call should set ref to the same value as its caller but the
    payload isn't documented
  • most of the events should set the sha to the last commit on the ref
    but unfortunately the sha is not always included in the payload,
    therefore we use the sha from the local git checkout

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/889 **Author:** [@ZauberNerd](https://github.com/ZauberNerd) **Created:** 11/17/2021 **Status:** ✅ Merged **Merged:** 1/21/2022 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `set-ref-sha` --- ### 📝 Commits (1) - [`18c3c61`](https://github.com/nektos/act/commit/18c3c61bab4e9c36f55a2461910bee99fea608c6) feat: try to read ref and sha from event payload if available ### 📊 Changes **3 files changed** (+247 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `pkg/model/github_context.go` (+113 -0) ➕ `pkg/model/github_context_test.go` (+132 -0) 📝 `pkg/runner/run_context.go` (+2 -51) </details> ### 📄 Description With this change `act` will try to populate the `githubContext.ref` and `githubContext.sha` with values read from the event payload. Caveats: - `page_build` should not have a ref - `status` should not have a ref - `registry_package` should set the ref to the branch/tag but the payload isn't documented - `workflow_call` should set ref to the same value as its caller but the payload isn't documented - most of the events should set the sha to the last commit on the ref but unfortunately the sha is not always included in the payload, therefore we use the sha from the local git checkout --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:52:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1668
No description provided.