Skip to content

Conversation

@YashodhanJoshi1
Copy link
Contributor

@YashodhanJoshi1 YashodhanJoshi1 commented Oct 8, 2025

User description

WIP PR for adding an addition key in the dispatch payload for the full sha


PR Type

Enhancement


Description

  • Include full commit SHA in env

  • Extend dispatch payload with full SHA

  • Preserve short SHA usage for compatibility


Diagram Walkthrough

flowchart LR
  A["GITHUB_HEAD_SHA"] -- "derive" --> B["SHORT_COMMIT_ID (7 chars)"]
  A -- "export" --> C["COMMIT_ID (full SHA)"]
  B -- "included as o2_commit_id" --> D["repository-dispatch payload"]
  C -- "included as o2_full_commit" --> D
Loading

File Walkthrough

Relevant files
Enhancement
dispatch-event-enterprise.yml
Add full SHA to workflow env and payload                                 

.github/workflows/dispatch-event-enterprise.yml

  • Export COMMIT_ID with full SHA to env
  • Add o2_full_commit to dispatch client-payload
  • Keep existing short SHA o2_commit_id
+2/-1     

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Payload Formatting

Ensure the JSON in 'client-payload' remains valid for all values, especially if branch names contain special characters. Consider using the 'toJson' function or a multiline mapping to avoid quoting/escape issues with GitHub expressions.

client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit":"${{env.COMMIT_ID}}"}'
Env Var Availability

Confirm that 'GITHUB_HEAD_SHA' is set in this workflow context for all triggers; if not, 'COMMIT_ID' could be empty. 'github.sha' may be a safer default fallback.

- name: Set build short sha
  shell: bash
  run: |
    unset SHORT_COMMIT_ID
    echo "SHORT_COMMIT_ID=${GITHUB_HEAD_SHA:0:7}" >> $GITHUB_ENV
    echo "COMMIT_ID=${GITHUB_HEAD_SHA}" >> $GITHUB_ENV

- name: Confirm git commit SHA output
  run: echo ${{ env.SHORT_COMMIT_ID }}

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR enhances the GitHub Actions workflow that triggers enterprise builds by adding the complete commit SHA to the dispatch payload. The change modifies the `dispatch-event-enterprise.yml` workflow to include both the existing 7-character short commit ID and a new full 40-character commit SHA in the payload sent to the enterprise repository.

The implementation adds a new environment variable COMMIT_ID that captures the complete GITHUB_HEAD_SHA and includes it as o2_full_commit in the client payload JSON alongside the existing o2_commit_id field. This change maintains backward compatibility while providing downstream enterprise build processes with access to the complete SHA for more precise git operations, verification, or tracking purposes.

The modification integrates seamlessly with the existing workflow structure, following the same pattern used for setting the short commit ID. The workflow continues to authenticate via GitHub App tokens, dispatch events to the openobserve/o2-enterprise repository, and pass branch information as before.

PR Description Notes:

  • Contains a typo: "addition" should be "additional"

Important Files Changed

Changed Files
Filename Score Overview
.github/workflows/dispatch-event-enterprise.yml 4/5 Adds full commit SHA to enterprise build dispatch payload alongside existing short SHA

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it only adds data to an existing payload without breaking changes
  • Score reflects straightforward implementation following existing patterns with minor formatting inconsistency
  • Pay attention to the JSON formatting inconsistency in the client-payload where spacing varies around colons

Sequence Diagram

sequenceDiagram
    participant User
    participant "GitHub PR" as PR
    participant "CI Workflow" as CI
    participant "GitHub Secrets" as Secrets
    participant "GitHub App" as App
    participant "Enterprise Repo" as Enterprise

    User->>PR: "Create pull request"
    PR->>CI: "Trigger workflow (pull_request event)"
    
    Note over CI: Check if PR is not from fork
    
    CI->>Secrets: "Request PRIVATE_KEY and APP_ID"
    Secrets-->>CI: "Return secrets"
    
    CI->>App: "Generate GitHub App token"
    App-->>CI: "Return installation access token"
    
    CI->>CI: "Extract SHORT_COMMIT_ID (first 7 chars)"
    CI->>CI: "Set COMMIT_ID (full SHA)"
    CI->>CI: "Log SHORT_COMMIT_ID for confirmation"
    
    CI->>Enterprise: "Dispatch repository event"
    Note over Enterprise: Event payload contains:<br/>- o2_enterprise_repo<br/>- o2_opensource_repo<br/>- o2_commit_id (short)<br/>- o2_full_commit (full SHA)
    
    Enterprise-->>CI: "Acknowledge dispatch"
Loading

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

repository: openobserve/o2-enterprise
event-type: initiate-enterprise-build
client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}"}'
client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit":"${{env.COMMIT_ID}}"}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Inconsistent spacing in JSON payload - missing space after colon in "o2_full_commit": while other properties have spaces

Suggested change
client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit":"${{env.COMMIT_ID}}"}'
client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit": "${{ env.COMMIT_ID }}"}'
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/dispatch-event-enterprise.yml
Line: 44:44

Comment:
**style:** Inconsistent spacing in JSON payload - missing space after colon in `"o2_full_commit":` while other properties have spaces

```suggestion
          client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit": "${{ env.COMMIT_ID }}"}'
```

How can I resolve this? If you propose a fix, please make it concise.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Quote env file redirection

Quote the variable expansion to prevent issues if the SHA contains unexpected
characters or is empty, and ensure the append target is quoted. This guards against
word-splitting and path issues in stricter shells.

.github/workflows/dispatch-event-enterprise.yml [30]

-echo "COMMIT_ID=${GITHUB_HEAD_SHA}" >> $GITHUB_ENV
+echo "COMMIT_ID=${GITHUB_HEAD_SHA}" >> "$GITHUB_ENV"
Suggestion importance[1-10]: 5

__

Why: Quoting $GITHUB_ENV is a minor robustness improvement in bash to avoid issues with paths containing spaces; change is correct and low-risk but not critical.

Low
Normalize expression and JSON spacing

Ensure consistent and correct GitHub expression spacing for readability and to avoid
parsing quirks; also keep JSON spacing consistent. This reduces chances of subtle
interpolation issues in workflow evaluation.

.github/workflows/dispatch-event-enterprise.yml [44]

-client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}" ,"o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit":"${{env.COMMIT_ID}}"}'
+client-payload: '{"o2_enterprise_repo": "${{ env.BRANCH_NAME }}", "o2_opensource_repo": "${{ env.BRANCH_NAME }}", "o2_commit_id": "${{ env.SHORT_COMMIT_ID }}", "o2_full_commit": "${{ env.COMMIT_ID }}"}'
Suggestion importance[1-10]: 4

__

Why: The suggested spacing is consistent and harmless, potentially improving readability; functional impact is minor since the original syntax is valid.

Low

@hengfeiyang hengfeiyang merged commit 2cf0d2d into main Nov 3, 2025
9 checks passed
@hengfeiyang hengfeiyang deleted the ci/status_check_ci branch November 3, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants