Skip to content

Commit 824619f

Browse files
committed
Send merge SHA for checkout and head SHA for status reporting
Downstream repos now receive the PR merge commit SHA (commcare_core_sha) for checkout — the same code commcare-core's build tests — and the head SHA (commcare_core_status_sha) for reporting status back to the PR.
1 parent e075b79 commit 824619f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
- name: Set pending status
6666
uses: actions/github-script@v7
6767
env:
68-
COMMCARE_CORE_SHA: ${{ github.event.pull_request.head.sha }}
68+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
6969
CHECK_NAME: ${{ matrix.check_name }}
7070
REPO: ${{ matrix.repo }}
7171
WORKFLOW_FILE: ${{ matrix.workflow_file }}
@@ -75,7 +75,7 @@ jobs:
7575
await github.rest.repos.createCommitStatus({
7676
owner: 'dimagi',
7777
repo: 'commcare-core',
78-
sha: process.env.COMMCARE_CORE_SHA,
78+
sha: process.env.HEAD_SHA,
7979
state: 'pending',
8080
context: process.env.CHECK_NAME,
8181
description: 'Waiting for downstream tests...',
@@ -85,7 +85,8 @@ jobs:
8585
- name: Trigger downstream workflow
8686
uses: actions/github-script@v7
8787
env:
88-
COMMCARE_CORE_SHA: ${{ github.event.pull_request.head.sha }}
88+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
89+
MERGE_SHA: ${{ github.sha }}
8990
COMMCARE_CORE_PR: ${{ github.event.pull_request.number }}
9091
CHECK_NAME: ${{ matrix.check_name }}
9192
REPO: ${{ matrix.repo }}
@@ -101,17 +102,18 @@ jobs:
101102
workflow_id: process.env.WORKFLOW_FILE,
102103
ref: 'master',
103104
inputs: {
104-
commcare_core_sha: process.env.COMMCARE_CORE_SHA,
105+
commcare_core_sha: process.env.MERGE_SHA,
105106
commcare_core_pr: process.env.COMMCARE_CORE_PR,
106-
commcare_core_check_name: process.env.CHECK_NAME
107+
commcare_core_check_name: process.env.CHECK_NAME,
108+
commcare_core_status_sha: process.env.HEAD_SHA
107109
}
108110
});
109111
} catch (error) {
110112
// If dispatch fails, set error status so it doesn't stay pending forever
111113
await github.rest.repos.createCommitStatus({
112114
owner: 'dimagi',
113115
repo: 'commcare-core',
114-
sha: process.env.COMMCARE_CORE_SHA,
116+
sha: process.env.HEAD_SHA,
115117
state: 'error',
116118
context: process.env.CHECK_NAME,
117119
description: `Failed to trigger: ${error.message}`.substring(0, 140)

0 commit comments

Comments
 (0)