Fix integration test: update user-agent validation to allow optional orchestration ID

Co-authored-by: angel-jiakou <115738347+angel-jiakou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/actions/github-script/sessions/d3f337be-6e6b-4278-a1da-9baf8f3c0263
This commit is contained in:
copilot-swe-agent[bot]
2026-03-23 20:39:06 +00:00
committed by GitHub
parent 3841a7fa4e
commit 831f1a15f4

View File

@@ -155,21 +155,21 @@ jobs:
result-encoding: string
- run: |
echo "- Validating user-agent default"
expected="actions/github-script octokit-core.js/"
if [[ "${{steps.user-agent-default.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-default.outputs.result}}"
actual="${{steps.user-agent-default.outputs.result}}"
if [[ ! "$actual" =~ ^actions/github-script([[:space:]]actions_orchestration_id/[^[:space:]]+)?[[:space:]]octokit-core\.js/ ]]; then
echo $'::error::\u274C' "Expected user-agent to match 'actions/github-script [actions_orchestration_id/...] octokit-core.js/...', got $actual"
exit 1
fi
echo "- Validating user-agent set to a value"
expected="foobar octokit-core.js/"
if [[ "${{steps.user-agent-set.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-set.outputs.result}}"
actual="${{steps.user-agent-set.outputs.result}}"
if [[ ! "$actual" =~ ^foobar([[:space:]]actions_orchestration_id/[^[:space:]]+)?[[:space:]]octokit-core\.js/ ]]; then
echo $'::error::\u274C' "Expected user-agent to match 'foobar [actions_orchestration_id/...] octokit-core.js/...', got $actual"
exit 1
fi
echo "- Validating user-agent set to an empty string"
expected="actions/github-script octokit-core.js/"
if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}"
actual="${{steps.user-agent-empty.outputs.result}}"
if [[ ! "$actual" =~ ^actions/github-script([[:space:]]actions_orchestration_id/[^[:space:]]+)?[[:space:]]octokit-core\.js/ ]]; then
echo $'::error::\u274C' "Expected user-agent to match 'actions/github-script [actions_orchestration_id/...] octokit-core.js/...', got $actual"
exit 1
fi
echo $'\u2705 Test passed' | tee -a $GITHUB_STEP_SUMMARY