From 1eb7e4e12100d78fc6e89956d57fbe3d05357e93 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 10:20:06 -0500 Subject: [PATCH 01/16] ci: create PR in emulator repo to build preview emulator binaries on testing SDK changes --- .github/workflows/create-emulator-pr.yml | 189 +++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 .github/workflows/create-emulator-pr.yml diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml new file mode 100644 index 0000000..26884a9 --- /dev/null +++ b/.github/workflows/create-emulator-pr.yml @@ -0,0 +1,189 @@ +name: Create Emulator PR + +on: + pull_request: + branches: [ main ] + types: [opened, synchronize, closed] + +permissions: + contents: read + +jobs: + cleanup-emulator-pr: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Delete emulator branch + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.EMULATOR_REPO_TOKEN }} + script: | + const branch_name = context.payload.pull_request.head.ref; + const emulator_branch = `testing-sdk-${branch_name}`; + + try { + await github.rest.git.deleteRef({ + owner: 'aws', + repo: 'aws-lambda-durable-functions-emulator', + ref: `heads/${emulator_branch}` + }); + console.log(`Deleted emulator branch: ${emulator_branch}`); + } catch (error) { + console.log(`Branch ${emulator_branch} may not exist or already deleted`); + } + + create-emulator-pr: + if: github.event.action == 'opened' || github.event.action == 'synchronize' + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Checkout emulator repo + uses: actions/checkout@v5 + with: + repository: aws/aws-lambda-durable-functions-emulator + token: ${{ secrets.EMULATOR_REPO_TOKEN }} + path: emulator + + - name: Create branch and update uv.lock + working-directory: emulator + run: | + # Configure git + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Get PR info + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" + PR_NUMBER="${{ github.event.pull_request.number }}" + TESTING_SDK_URL="git+ssh://git@github.com/${{ github.repository }}.git@${BRANCH_NAME}" + + # Create or update branch + git fetch origin + if git show-ref --verify --quiet refs/remotes/origin/"$EMULATOR_BRANCH"; then + git checkout "$EMULATOR_BRANCH" + git reset --hard origin/main + else + git checkout -b "$EMULATOR_BRANCH" + fi + + # Update pyproject.toml to use the testing SDK branch (temporary, not committed) + sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ ${TESTING_SDK_URL}|" pyproject.toml + rm pyproject.toml.bak + + # Generate new uv.lock with the specific testing SDK commit + uv lock + + # Show what changed + echo "=== Changes to be committed ===" + git diff --name-status + git diff uv.lock || echo "uv.lock is a new file" + + # Restore original pyproject.toml (don't commit the temporary change) + git checkout pyproject.toml + + # Commit and push only the uv.lock file + git add uv.lock + git commit -m "Lock testing SDK branch: $BRANCH_NAME (PR #$PR_NUMBER)" || echo "No changes to commit" + git push origin "$EMULATOR_BRANCH" + + - name: Create or update PR in emulator repo + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.EMULATOR_REPO_TOKEN }} + script: | + const pr = context.payload.pull_request; + const branch_name = pr.head.ref; + const emulator_branch = `testing-sdk-${branch_name}`; + + const pr_body = `*Issue #, if available:* Related to aws/aws-durable-execution-sdk-python-testing#${pr.number} + +*Description of changes:* Testing changes from testing SDK branch \`${branch_name}\` + +## Dependencies +This PR locks the testing SDK to a specific commit from branch \`${branch_name}\` using uv.lock for reproducible builds. + +**Testing SDK Dependency:** \`git+https://github.com/${context.repo.owner}/${context.repo.repo}.git@${branch_name}\` + +The emulator binaries will be built using the exact testing SDK commit locked in uv.lock from PR aws/aws-durable-execution-sdk-python-testing#${pr.number}. + +## Testing + +- [ ] Binaries created successfully with locked dependencies +- [ ] Emulator functionality verified with new testing SDK changes + +## Checklist + +- [ ] Code follows project style guidelines +- [ ] Self-review completed +- [ ] Changes are backward compatible (or breaking changes documented) + +By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.`; + + try { + // Check if PR already exists + let existingPR = null; + try { + const prs = await github.rest.pulls.list({ + owner: 'aws', + repo: 'aws-lambda-durable-functions-emulator', + head: `aws:${emulator_branch}`, + state: 'open' + }); + existingPR = prs.data[0]; + } catch (e) { + console.log('No existing PR found'); + } + + if (existingPR) { + // Update existing PR + await github.rest.pulls.update({ + owner: 'aws', + repo: 'aws-lambda-durable-functions-emulator', + pull_number: existingPR.number, + title: `Lock testing SDK branch: ${branch_name} (PR #${pr.number})`, + body: pr_body + }); + + console.log(`Updated emulator PR: ${existingPR.html_url}`); + + // Comment on original PR about update + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body: `🔄 **Emulator PR Updated**\n\nThe emulator PR has been updated with locked dependencies:\n\n➡️ ${existingPR.html_url}` + }); + } else { + // Create new PR + const response = await github.rest.pulls.create({ + owner: 'aws', + repo: 'aws-lambda-durable-functions-emulator', + title: `Lock testing SDK branch: ${branch_name} (PR #${pr.number})`, + head: emulator_branch, + base: 'main', + body: pr_body, + draft: true + }); + + console.log(`Created emulator PR: ${response.data.html_url}`); + + // Comment on original PR + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body: `🤖 **Emulator PR Created**\n\nA draft PR has been created with locked dependencies:\n\n➡️ ${response.data.html_url}\n\nThe emulator will build binaries using the exact testing SDK commit locked in uv.lock.` + }); + } + + } catch (error) { + console.log(`Error managing PR: ${error.message}`); + core.setFailed(`Failed to manage emulator PR: ${error.message}`); + } From 607e8651d9143e818d6e2b38a02d0d07019f478a Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 10:23:22 -0500 Subject: [PATCH 02/16] chore: update --- .github/workflows/create-emulator-pr.yml | 42 ++++++++++-------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 26884a9..860969a 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -13,24 +13,18 @@ jobs: if: github.event.action == 'closed' runs-on: ubuntu-latest steps: - - name: Delete emulator branch - uses: actions/github-script@v7 + - uses: webfactory/ssh-agent@v0.9.1 with: - github-token: ${{ secrets.EMULATOR_REPO_TOKEN }} - script: | - const branch_name = context.payload.pull_request.head.ref; - const emulator_branch = `testing-sdk-${branch_name}`; - - try { - await github.rest.git.deleteRef({ - owner: 'aws', - repo: 'aws-lambda-durable-functions-emulator', - ref: `heads/${emulator_branch}` - }); - console.log(`Deleted emulator branch: ${emulator_branch}`); - } catch (error) { - console.log(`Branch ${emulator_branch} may not exist or already deleted`); - } + ssh-private-key: ${{ secrets.SDK_KEY }} + + - name: Delete emulator branch + run: | + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" + + git clone git@github.com:aws/aws-lambda-durable-functions-emulator.git + cd aws-lambda-durable-functions-emulator + git push origin --delete "$EMULATOR_BRANCH" || echo "Branch may not exist" create-emulator-pr: if: github.event.action == 'opened' || github.event.action == 'synchronize' @@ -44,12 +38,13 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v4 - - name: Checkout emulator repo - uses: actions/checkout@v5 + - uses: webfactory/ssh-agent@v0.9.1 with: - repository: aws/aws-lambda-durable-functions-emulator - token: ${{ secrets.EMULATOR_REPO_TOKEN }} - path: emulator + ssh-private-key: ${{ secrets.SDK_KEY }} + + - name: Checkout emulator repo + run: | + git clone git@github.com:aws/aws-lambda-durable-functions-emulator.git emulator - name: Create branch and update uv.lock working-directory: emulator @@ -96,7 +91,6 @@ jobs: - name: Create or update PR in emulator repo uses: actions/github-script@v7 with: - github-token: ${{ secrets.EMULATOR_REPO_TOKEN }} script: | const pr = context.payload.pull_request; const branch_name = pr.head.ref; @@ -109,7 +103,7 @@ jobs: ## Dependencies This PR locks the testing SDK to a specific commit from branch \`${branch_name}\` using uv.lock for reproducible builds. -**Testing SDK Dependency:** \`git+https://github.com/${context.repo.owner}/${context.repo.repo}.git@${branch_name}\` +**Testing SDK Dependency:** \`git+ssh://git@github.com/${context.repo.owner}/${context.repo.repo}.git@${branch_name}\` The emulator binaries will be built using the exact testing SDK commit locked in uv.lock from PR aws/aws-durable-execution-sdk-python-testing#${pr.number}. From cf4171888e4a4180b9b91140247d7bf708219f92 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 10:31:09 -0500 Subject: [PATCH 03/16] chore: fix syntax --- .github/workflows/create-emulator-pr.yml | 29 +++++------------------ .github/workflows/emulator-pr-template.md | 11 +++++++++ 2 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/emulator-pr-template.md diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 860969a..bd396f3 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -92,33 +92,16 @@ jobs: uses: actions/github-script@v7 with: script: | + const fs = require('fs'); const pr = context.payload.pull_request; const branch_name = pr.head.ref; const emulator_branch = `testing-sdk-${branch_name}`; - const pr_body = `*Issue #, if available:* Related to aws/aws-durable-execution-sdk-python-testing#${pr.number} - -*Description of changes:* Testing changes from testing SDK branch \`${branch_name}\` - -## Dependencies -This PR locks the testing SDK to a specific commit from branch \`${branch_name}\` using uv.lock for reproducible builds. - -**Testing SDK Dependency:** \`git+ssh://git@github.com/${context.repo.owner}/${context.repo.repo}.git@${branch_name}\` - -The emulator binaries will be built using the exact testing SDK commit locked in uv.lock from PR aws/aws-durable-execution-sdk-python-testing#${pr.number}. - -## Testing - -- [ ] Binaries created successfully with locked dependencies -- [ ] Emulator functionality verified with new testing SDK changes - -## Checklist - -- [ ] Code follows project style guidelines -- [ ] Self-review completed -- [ ] Changes are backward compatible (or breaking changes documented) - -By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.`; + // Read and populate PR template + const template = fs.readFileSync('.github/workflows/emulator-pr-template.md', 'utf8'); + const pr_body = template + .replace(/{{PR_NUMBER}}/g, pr.number) + .replace(/{{BRANCH_NAME}}/g, branch_name); try { // Check if PR already exists diff --git a/.github/workflows/emulator-pr-template.md b/.github/workflows/emulator-pr-template.md new file mode 100644 index 0000000..4fca5da --- /dev/null +++ b/.github/workflows/emulator-pr-template.md @@ -0,0 +1,11 @@ +*Issue #, if available:* Related to aws/aws-durable-execution-sdk-python-testing#{{PR_NUMBER}} + +*Description of changes:* Testing changes from testing SDK branch `{{BRANCH_NAME}}` using locked dependencies in uv.lock + +## Dependencies +This PR locks the testing SDK to a specific commit from branch `{{BRANCH_NAME}}` using uv.lock for reproducible builds. + + + + +By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. From ac56d317c0716398e78bd1bbd91b86160ebaaf02 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 10:51:48 -0500 Subject: [PATCH 04/16] chore: update secret name --- .github/workflows/create-emulator-pr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index bd396f3..6e65269 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: webfactory/ssh-agent@v0.9.1 with: - ssh-private-key: ${{ secrets.SDK_KEY }} + ssh-private-key: ${{ secrets.EMULATOR_KEY }} - name: Delete emulator branch run: | @@ -40,7 +40,9 @@ jobs: - uses: webfactory/ssh-agent@v0.9.1 with: - ssh-private-key: ${{ secrets.SDK_KEY }} + ssh-private-key: | + ${{ secrets.EMULATOR_PRIVATE_KEY }} + ${{ secrets.SDK_KEY }} - name: Checkout emulator repo run: | From c321fe2e7a4209b62a378efb9254356689ed184c Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:04:08 -0500 Subject: [PATCH 05/16] chore: update 2 --- .github/workflows/create-emulator-pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 6e65269..af10110 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -59,7 +59,6 @@ jobs: BRANCH_NAME="${{ github.event.pull_request.head.ref }}" EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" PR_NUMBER="${{ github.event.pull_request.number }}" - TESTING_SDK_URL="git+ssh://git@github.com/${{ github.repository }}.git@${BRANCH_NAME}" # Create or update branch git fetch origin @@ -70,8 +69,8 @@ jobs: git checkout -b "$EMULATOR_BRANCH" fi - # Update pyproject.toml to use the testing SDK branch (temporary, not committed) - sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ ${TESTING_SDK_URL}|" pyproject.toml + # Update pyproject.toml to use local testing SDK (temporary, not committed) + sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://$GITHUB_WORKSPACE|" pyproject.toml rm pyproject.toml.bak # Generate new uv.lock with the specific testing SDK commit From 6a6c6104ee2b315a1456e8826fb6ce08b7f1b098 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:25:40 -0500 Subject: [PATCH 06/16] chore: update --- .github/workflows/create-emulator-pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index af10110..c041df3 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -70,7 +70,8 @@ jobs: fi # Update pyproject.toml to use local testing SDK (temporary, not committed) - sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://$GITHUB_WORKSPACE|" pyproject.toml + TESTING_SDK_PATH="$(realpath $GITHUB_WORKSPACE)" + sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://${TESTING_SDK_PATH}|" pyproject.toml rm pyproject.toml.bak # Generate new uv.lock with the specific testing SDK commit From 51fa93c12daf92704881d6cd6964db513d9654d1 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:27:35 -0500 Subject: [PATCH 07/16] more logging --- .github/workflows/create-emulator-pr.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index c041df3..ba6b9a6 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -70,8 +70,12 @@ jobs: fi # Update pyproject.toml to use local testing SDK (temporary, not committed) - TESTING_SDK_PATH="$(realpath $GITHUB_WORKSPACE)" - sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://${TESTING_SDK_PATH}|" pyproject.toml + echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" + echo "Current directory: $(pwd)" + echo "Parent directory contents:" + ls -la ../ + TESTING_SDK_PATH="../aws-durable-execution-sdk-python-testing" + sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://$PWD/${TESTING_SDK_PATH}|" pyproject.toml rm pyproject.toml.bak # Generate new uv.lock with the specific testing SDK commit From 89f154f9f20fe1be6ed6fde8f74723c4982b304f Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:32:06 -0500 Subject: [PATCH 08/16] fix: checkout testing sdk repo too --- .github/workflows/create-emulator-pr.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index ba6b9a6..ec92d8e 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -30,6 +30,11 @@ jobs: if: github.event.action == 'opened' || github.event.action == 'synchronize' runs-on: ubuntu-latest steps: + - name: Checkout testing SDK repo + uses: actions/checkout@v5 + with: + path: testing-sdk + - name: Set up Python uses: actions/setup-python@v6 with: @@ -70,12 +75,8 @@ jobs: fi # Update pyproject.toml to use local testing SDK (temporary, not committed) - echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" - echo "Current directory: $(pwd)" - echo "Parent directory contents:" - ls -la ../ - TESTING_SDK_PATH="../aws-durable-execution-sdk-python-testing" - sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://$PWD/${TESTING_SDK_PATH}|" pyproject.toml + TESTING_SDK_PATH="$(realpath ../testing-sdk)" + sed -i.bak "s|aws-durable-execution-sdk-python-testing @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python-testing.git|aws-durable-execution-sdk-python-testing @ file://${TESTING_SDK_PATH}|" pyproject.toml rm pyproject.toml.bak # Generate new uv.lock with the specific testing SDK commit From 983b03a9c4aa165245f96e87652c6d6e94dca32e Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:36:14 -0500 Subject: [PATCH 09/16] chore: fix path to pr template --- .github/workflows/create-emulator-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index ec92d8e..826c240 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -105,7 +105,7 @@ jobs: const emulator_branch = `testing-sdk-${branch_name}`; // Read and populate PR template - const template = fs.readFileSync('.github/workflows/emulator-pr-template.md', 'utf8'); + const template = fs.readFileSync('../testing-sdk/.github/workflows/emulator-pr-template.md', 'utf8'); const pr_body = template .replace(/{{PR_NUMBER}}/g, pr.number) .replace(/{{BRANCH_NAME}}/g, branch_name); From a32b32241c0521519941fcbd9e4ce5413312c92a Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:39:16 -0500 Subject: [PATCH 10/16] update --- .github/workflows/create-emulator-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 826c240..c6b5a6c 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -93,7 +93,7 @@ jobs: # Commit and push only the uv.lock file git add uv.lock git commit -m "Lock testing SDK branch: $BRANCH_NAME (PR #$PR_NUMBER)" || echo "No changes to commit" - git push origin "$EMULATOR_BRANCH" + git push --force-with-lease origin "$EMULATOR_BRANCH" - name: Create or update PR in emulator repo uses: actions/github-script@v7 From 2ffed63e78cd13104673e2950fc019ff17af1350 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:49:07 -0500 Subject: [PATCH 11/16] chore: update --- .github/workflows/create-emulator-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index c6b5a6c..9056a0f 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -104,8 +104,12 @@ jobs: const branch_name = pr.head.ref; const emulator_branch = `testing-sdk-${branch_name}`; + // Debug: check current directory and list files + console.log('Current working directory:', process.cwd()); + console.log('Directory contents:', fs.readdirSync('.')); + // Read and populate PR template - const template = fs.readFileSync('../testing-sdk/.github/workflows/emulator-pr-template.md', 'utf8'); + const template = fs.readFileSync('testing-sdk/.github/workflows/emulator-pr-template.md', 'utf8'); const pr_body = template .replace(/{{PR_NUMBER}}/g, pr.number) .replace(/{{BRANCH_NAME}}/g, branch_name); From c8c206f5d9048c985f793b753594038dcdfde033 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 11:55:32 -0500 Subject: [PATCH 12/16] chore: more logging --- .github/workflows/create-emulator-pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 9056a0f..be5d50f 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -98,6 +98,7 @@ jobs: - name: Create or update PR in emulator repo uses: actions/github-script@v7 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const fs = require('fs'); const pr = context.payload.pull_request; @@ -173,5 +174,7 @@ jobs: } catch (error) { console.log(`Error managing PR: ${error.message}`); + console.log(`Error status: ${error.status}`); + console.log(`Error response: ${JSON.stringify(error.response?.data)}`); core.setFailed(`Failed to manage emulator PR: ${error.message}`); } From 6a8baf4da78ba474bd2760f983582e5f7ba9a900 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 12:05:03 -0500 Subject: [PATCH 13/16] chore: fix repo name --- .github/workflows/create-emulator-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index be5d50f..bba0341 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -121,7 +121,7 @@ jobs: try { const prs = await github.rest.pulls.list({ owner: 'aws', - repo: 'aws-lambda-durable-functions-emulator', + repo: 'aws-durable-execution-emulator', head: `aws:${emulator_branch}`, state: 'open' }); @@ -134,7 +134,7 @@ jobs: // Update existing PR await github.rest.pulls.update({ owner: 'aws', - repo: 'aws-lambda-durable-functions-emulator', + repo: 'aws-durable-execution-emulator', pull_number: existingPR.number, title: `Lock testing SDK branch: ${branch_name} (PR #${pr.number})`, body: pr_body @@ -153,7 +153,7 @@ jobs: // Create new PR const response = await github.rest.pulls.create({ owner: 'aws', - repo: 'aws-lambda-durable-functions-emulator', + repo: 'aws-durable-execution-emulator', title: `Lock testing SDK branch: ${branch_name} (PR #${pr.number})`, head: emulator_branch, base: 'main', From 0951b7758d6ad28cf1bf40df1bd8169e290e79e4 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 12:08:58 -0500 Subject: [PATCH 14/16] logging --- .github/workflows/create-emulator-pr.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index bba0341..eec6161 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -22,8 +22,8 @@ jobs: BRANCH_NAME="${{ github.event.pull_request.head.ref }}" EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" - git clone git@github.com:aws/aws-lambda-durable-functions-emulator.git - cd aws-lambda-durable-functions-emulator + git clone git@github.com:aws/aws-durable-execution-emulator.git + cd aws-durable-execution-emulator git push origin --delete "$EMULATOR_BRANCH" || echo "Branch may not exist" create-emulator-pr: @@ -51,7 +51,7 @@ jobs: - name: Checkout emulator repo run: | - git clone git@github.com:aws/aws-lambda-durable-functions-emulator.git emulator + git clone git@github.com:aws/aws-durable-execution-emulator.git emulator - name: Create branch and update uv.lock working-directory: emulator @@ -151,6 +151,7 @@ jobs: }); } else { // Create new PR + console.log("Creating an emulator PR") const response = await github.rest.pulls.create({ owner: 'aws', repo: 'aws-durable-execution-emulator', From 9096be982368ab11b67653ec616c57d4af71cb5c Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 12:19:09 -0500 Subject: [PATCH 15/16] update token --- .github/workflows/create-emulator-pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index eec6161..3091592 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -7,6 +7,8 @@ on: permissions: contents: read + pull-requests: write + issues: write jobs: cleanup-emulator-pr: @@ -98,7 +100,7 @@ jobs: - name: Create or update PR in emulator repo uses: actions/github-script@v7 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.EMULATOR_REPO_TOKEN }} script: | const fs = require('fs'); const pr = context.payload.pull_request; From 21199c3901d2cbd35a02066202ac6c5979f959b8 Mon Sep 17 00:00:00 2001 From: Brent Champion Date: Sun, 23 Nov 2025 13:06:41 -0500 Subject: [PATCH 16/16] chore: update branch name for PR --- .github/workflows/create-emulator-pr.yml | 24 ++++++++++++++--------- .github/workflows/emulator-pr-template.md | 4 ++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/create-emulator-pr.yml b/.github/workflows/create-emulator-pr.yml index 3091592..ff53a88 100644 --- a/.github/workflows/create-emulator-pr.yml +++ b/.github/workflows/create-emulator-pr.yml @@ -21,8 +21,8 @@ jobs: - name: Delete emulator branch run: | - BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" + PR_NUMBER="${{ github.event.pull_request.number }}" + EMULATOR_BRANCH="testing-sdk-pr-${PR_NUMBER}-sync" git clone git@github.com:aws/aws-durable-execution-emulator.git cd aws-durable-execution-emulator @@ -64,8 +64,8 @@ jobs: # Get PR info BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - EMULATOR_BRANCH="testing-sdk-${BRANCH_NAME}" PR_NUMBER="${{ github.event.pull_request.number }}" + EMULATOR_BRANCH="testing-sdk-pr-${PR_NUMBER}-sync" # Create or update branch git fetch origin @@ -94,8 +94,15 @@ jobs: # Commit and push only the uv.lock file git add uv.lock - git commit -m "Lock testing SDK branch: $BRANCH_NAME (PR #$PR_NUMBER)" || echo "No changes to commit" - git push --force-with-lease origin "$EMULATOR_BRANCH" + if git commit -m "Lock testing SDK branch: $BRANCH_NAME (PR #$PR_NUMBER)"; then + echo "Changes committed successfully" + git push --force-with-lease origin "$EMULATOR_BRANCH" + echo "Branch pushed successfully" + else + echo "No changes to commit" + # Still need to push the branch even if no changes + git push --force-with-lease origin "$EMULATOR_BRANCH" || git push origin "$EMULATOR_BRANCH" + fi - name: Create or update PR in emulator repo uses: actions/github-script@v7 @@ -105,11 +112,10 @@ jobs: const fs = require('fs'); const pr = context.payload.pull_request; const branch_name = pr.head.ref; - const emulator_branch = `testing-sdk-${branch_name}`; + const emulator_branch = `testing-sdk-pr-${pr.number}-sync`; - // Debug: check current directory and list files - console.log('Current working directory:', process.cwd()); - console.log('Directory contents:', fs.readdirSync('.')); + // Wait a moment for branch to be available + await new Promise(resolve => setTimeout(resolve, 2000)); // Read and populate PR template const template = fs.readFileSync('testing-sdk/.github/workflows/emulator-pr-template.md', 'utf8'); diff --git a/.github/workflows/emulator-pr-template.md b/.github/workflows/emulator-pr-template.md index 4fca5da..96fd09f 100644 --- a/.github/workflows/emulator-pr-template.md +++ b/.github/workflows/emulator-pr-template.md @@ -5,7 +5,7 @@ ## Dependencies This PR locks the testing SDK to a specific commit from branch `{{BRANCH_NAME}}` using uv.lock for reproducible builds. - - +PYTHON_LANGUAGE_SDK_BRANCH: main +PYTHON_TESTING_SDK_BRANCH: {{BRANCH_NAME}} By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.