From 9f5adfefe370f2eba646c1a90bdf05643c1fd2b9 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 29 May 2025 17:02:11 -0700 Subject: [PATCH] Add action that ensures the node test is downloaded from node's repo --- .github/workflows/codex-test-sync.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/codex-test-sync.yml diff --git a/.github/workflows/codex-test-sync.yml b/.github/workflows/codex-test-sync.yml new file mode 100644 index 0000000000..cf48f46710 --- /dev/null +++ b/.github/workflows/codex-test-sync.yml @@ -0,0 +1,45 @@ +name: Codex Test Sync + +on: + pull_request: + types: [labeled, opened] + +env: + BUN_VERSION: "canary" + +jobs: + sync-node-tests: + runs-on: ubuntu-latest + if: | + (github.event.action == 'labeled' && github.event.label.name == 'codex') || + (github.event.action == 'opened' && contains(github.event.pull_request.labels.*.name, 'codex')) + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Setup Bun + uses: ./.github/actions/setup-bun + with: + bun-version: ${{ env.BUN_VERSION }} + + - name: Get changed files and sync tests + run: | + # Get the list of changed files from the PR + git diff --name-only origin/main...HEAD | while read -r file; do + if [[ "$file" =~ ^test/js/node/test/(parallel|sequential)/(.+)\.js$ ]]; then + test_name="${BASH_REMATCH[2]}" + echo "Syncing test: $test_name" + bun node:test:cp "$test_name" + fi + done + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Sync Node.js tests with upstream"