π OpenHands: AI-Driven Development
Update workflow shell context handling (#14478)
Graham Neubig0916b25251de
diff --git a/.github/workflows/enterprise-check-migrations.yml b/.github/workflows/enterprise-check-migrations.ymlindex 4bce3397d8..89ec7afee7 100644--- a/.github/workflows/enterprise-check-migrations.yml+++ b/.github/workflows/enterprise-check-migrations.yml@@ -17,14 +17,19 @@ jobs:- name: Fetch base branch- run: git fetch origin ${{ github.event.pull_request.base.ref }}+ env:+ BASE_REF: ${{ github.event.pull_request.base.ref }}+ run: git fetch origin "$BASE_REF"- name: Check if base branch is ancestor of PRid: check_up_to_dateshell: bash+ env:+ BASE_REF: ${{ github.event.pull_request.base.ref }}+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}run: |- BASE="origin/${{ github.event.pull_request.base.ref }}"- HEAD="${{ github.event.pull_request.head.sha }}"+ BASE="origin/${BASE_REF}"+ HEAD="$HEAD_SHA"if git merge-base --is-ancestor "$BASE" "$HEAD"; thenecho "We're up to date with base $BASE"exit 0diff --git a/.github/workflows/ghcr-build.yml b/.github/workflows/ghcr-build.ymlindex 0bff67076a..2e3f9a2dbe 100644--- a/.github/workflows/ghcr-build.yml+++ b/.github/workflows/ghcr-build.yml@@ -54,7 +54,9 @@ jobs:- name: Get short SHAid: short_sha- run: echo "SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"+ env:+ PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}+ run: printf 'SHORT_SHA=%s\n' "${PR_HEAD_SHA:0:7}" >> "$GITHUB_OUTPUT"- name: Update PR Descriptionenv:diff --git a/.github/workflows/issue-duplicate-checker.yml b/.github/workflows/issue-duplicate-checker.ymlindex f86a5aed88..53d9fedf5c 100644--- a/.github/workflows/issue-duplicate-checker.yml+++ b/.github/workflows/issue-duplicate-checker.yml@@ -41,8 +41,10 @@ jobs:uses: actions/checkout@v6- name: Clone repository+ env:+ REPOSITORY: ${{ github.repository }}run: |- git clone --depth 1 "https://github.com/${{ github.repository }}.git" /tmp/repo-clone+ git clone --depth 1 "https://github.com/${REPOSITORY}.git" /tmp/repo-cloneecho "Repository HEAD: $(git -C /tmp/repo-clone rev-parse --short HEAD)"- name: Summarize smoke test@@ -92,9 +94,10 @@ jobs:GITHUB_TOKEN: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_PUBLIC || github.token }}ISSUE_NUMBER: ${{ github.event.issue.number || inputs.issue_number }}OUTPUT_PATH: ${{ runner.temp }}/issue-duplicate-check-result.json+ REPOSITORY: ${{ github.repository }}run: |python scripts/issue_duplicate_check_openhands.py \- --repository "${{ github.repository }}" \+ --repository "$REPOSITORY" \--issue-number "$ISSUE_NUMBER" \--output "$OUTPUT_PATH"test -f "$OUTPUT_PATH" || {@@ -451,7 +454,7 @@ jobs:CLOSE_AFTER_DAYS: ${{ inputs.close_after_days || '3' }}run: |python scripts/auto_close_duplicate_issues.py \- --repository "${{ github.repository }}" \+ --repository "$REPOSITORY" \--close-after-days "$CLOSE_AFTER_DAYS" | tee "$RUNNER_TEMP/auto-close-summary.json"status=${PIPESTATUS[0]}if [ "$status" -ne 0 ]; thendiff --git a/.github/workflows/npm-publish-ui.yml b/.github/workflows/npm-publish-ui.ymlindex f3e7b68245..c8f8a4be56 100644--- a/.github/workflows/npm-publish-ui.yml+++ b/.github/workflows/npm-publish-ui.yml@@ -81,9 +81,11 @@ jobs:- name: Check if package already exists on npmid: npm-checkworking-directory: ./openhands-ui+ env:+ CURRENT_VERSION: ${{ needs.check-version.outputs.current-version }}run: |PACKAGE_NAME=$(jq -r .name package.json)- VERSION="${{ needs.check-version.outputs.current-version }}"+ VERSION="$CURRENT_VERSION"# Check if this version already exists on npmif npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then@@ -96,13 +98,17 @@ jobs:- name: Setup npm authenticationif: steps.npm-check.outputs.already-exists == 'false'+ env:+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}run: |- echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc- name: Publish to npmif: steps.npm-check.outputs.already-exists == 'false'working-directory: ./openhands-ui+ env:+ CURRENT_VERSION: ${{ needs.check-version.outputs.current-version }}run: |# The prepublishOnly script will run automatically and build the packagenpm publish- echo "β Successfully published @openhands/ui@${{ needs.check-version.outputs.current-version }} to npm"+ echo "β Successfully published @openhands/ui@${CURRENT_VERSION} to npm"diff --git a/.github/workflows/pr-artifacts.yml b/.github/workflows/pr-artifacts.ymlindex db6e1fbf71..e9262a3220 100644--- a/.github/workflows/pr-artifacts.yml+++ b/.github/workflows/pr-artifacts.yml@@ -23,8 +23,11 @@ jobs:steps:- name: Check if fork PRid: check-fork+ env:+ HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}+ BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }}run: |- if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then+ if [ "$HEAD_REPO" != "$BASE_REPO" ]; thenecho "is_fork=true" >> $GITHUB_OUTPUTecho "::notice::Fork PR detected - skipping auto-cleanup (manual removal required)"elsediff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.ymlindex 8414f686c1..a3a03a0acf 100644--- a/.github/workflows/pypi-release.yml+++ b/.github/workflows/pypi-release.yml@@ -37,4 +37,6 @@ jobs:- name: Build poetry projectrun: ./build.sh- name: publish- run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}+ env:+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}+ run: poetry publish -u __token__ -p "$PYPI_TOKEN"diff --git a/.github/workflows/tag-image.yml b/.github/workflows/tag-image.ymlindex 91f4a19d3a..b285c8b023 100644--- a/.github/workflows/tag-image.yml+++ b/.github/workflows/tag-image.yml@@ -44,11 +44,12 @@ jobs:env:SRC: ${{ matrix.image }}:sha-${{ github.sha }}TAGS: ${{ steps.meta.outputs.tags }}+ COMMIT_SHA: ${{ github.sha }}shell: bashrun: |set -euo pipefailif ! docker buildx imagetools inspect "$SRC" > /dev/null 2>&1; then- echo "::error::Source image $SRC does not exist. The Docker workflow for commit ${{ github.sha }} may not have completed successfully. Re-run this workflow once the build finishes."+ echo "::error::Source image $SRC does not exist. The Docker workflow for commit $COMMIT_SHA may not have completed successfully. Re-run this workflow once the build finishes."exit 1fiargs=()