Skip to content

Commit 4055173

Browse files
authored
Change substitution to occur via environment variables. (#928)
* Change substitution to occur via environment variables. * Fix missing suffix.
1 parent db37760 commit 4055173

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/integration_tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ jobs:
123123
- name: Install python deps
124124
run: pip install -r scripts/gha/requirements.txt
125125
- id: matrix_config
126+
env:
127+
HEAD_REF: ${{github.event.pull_request.head.ref}}
128+
BASE_REF: ${{github.event.pull_request.base.ref}}
126129
run: |
127130
# Log that we ran against a given packaged SDK.
128131
if [[ -n "${{ github.event.inputs.packaged_sdk_run_id }}" ]]; then
@@ -137,12 +140,12 @@ jobs:
137140
elif [[ "${{ steps.set_outputs.outputs.requested_tests }}" == "auto" ]]; then
138141
# auto-diff only apply when running in a PR.
139142
# diff against the PR's base. "git merge-base main branch_name" will give the common ancestor of both branches.
140-
MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}} || true)
143+
MERGE_BASE=$(git merge-base "origin/${HEAD_REF}" "origin/${BASE_REF}" || true)
141144
# If origin/<branch> is no longer valid, then just run all tests.
142145
if [[ -n "${MERGE_BASE}" ]]; then
143-
echo "::warning ::Auto-diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}"
144-
git diff --name-only origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}
145-
TEST_MATRIX_PARAM="--auto_diff origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}"
146+
echo "::warning ::Auto-diff origin/${HEAD_REF}..${MERGE_BASE}"
147+
git diff --name-only "origin/${HEAD_REF}..${MERGE_BASE}"
148+
TEST_MATRIX_PARAM="--auto_diff origin/${HEAD_REF}..${MERGE_BASE}"
146149
fi
147150
fi
148151
# To feed input into the job matrix, we first need to convert to a JSON

scripts/gha/it_workflow.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
_COMMENT_IDENTIFIER_DASHBOARD = "build-dashboard-comment"
7272
_COMMENT_DASHBOARD_START = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}-start"></hidden>\r\n'
7373
_COMMENT_DASHBOARD_END = f'\r\n<hidden value="{_COMMENT_IDENTIFIER_DASHBOARD}-end"></hidden>\r\n'
74+
_COMMENT_SUFFIX = f'\n<hidden value="{_COMMENT_IDENTIFIER}"></hidden>'
7475

7576
_LOG_ARTIFACT_NAME = "log-artifact"
7677
_LOG_OUTPUT_DIR = "test_results"
@@ -227,11 +228,18 @@ def _get_issue_number(token, title, label):
227228
if issue["title"] == title:
228229
return issue["number"]
229230

230-
return firebase_github.create_issue(token, title, label, _COMMENT_SUFFIX)["number"]
231+
empty_comment = (" " +
232+
_COMMENT_DASHBOARD_START + " " +
233+
_COMMENT_DASHBOARD_END + " " +
234+
_COMMENT_HIDDEN_DIVIDER + " " +
235+
_COMMENT_HIDDEN_DIVIDER + " " +
236+
_COMMENT_HIDDEN_DIVIDER + " "
237+
)
238+
return firebase_github.create_issue(token, title, label, empty_comment)["number"]
231239

232240

233241
def _update_comment(token, issue_number, comment):
234-
comment_id = _get_comment_id(token, issue_number, _COMMENT_SUFFIX)
242+
comment_id = _get_comment_id(token, issue_number, _COMMENT_HIDDEN_DIVIDER)
235243
if not comment_id:
236244
firebase_github.add_comment(token, issue_number, comment)
237245
else:

0 commit comments

Comments
 (0)