|
| 1 | +name: Auto-update Temporal SDK |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - auto-updater |
| 7 | + workflow_dispatch: |
| 8 | + # Allow manual triggering |
| 9 | + |
| 10 | +env: |
| 11 | + # Use a personal access token with repo scope for creating PRs |
| 12 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + check-and-update: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + # Fetch full history for better git operations |
| 23 | + fetch-depth: 0 |
| 24 | + # Use token for authentication |
| 25 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + |
| 27 | + - name: Setup Nix |
| 28 | + uses: cachix/install-nix-action@v26 |
| 29 | + |
| 30 | + - name: Setup Cachix |
| 31 | + uses: cachix/cachix-action@v14 |
| 32 | + with: |
| 33 | + name: devenv |
| 34 | + |
| 35 | + - name: Make script executable |
| 36 | + run: chmod +x scripts/update-temporal-revision.sh |
| 37 | + |
| 38 | + - name: Check for new Temporal revision |
| 39 | + id: check-revision |
| 40 | + run: | |
| 41 | + # Enter devenv shell and check for updates |
| 42 | + nix develop . --impure --accept-flake-config --command ' |
| 43 | + # Get current revision |
| 44 | + CURRENT_REV=$(./scripts/update-temporal-revision.sh --dry-run next 2>&1 | grep "Target revision:" | cut -d" " -f3) |
| 45 | +
|
| 46 | + # Get the next revision |
| 47 | + NEXT_REV=$(./scripts/update-temporal-revision.sh --dry-run next 2>&1 | grep "Target revision:" | cut -d" " -f3) |
| 48 | +
|
| 49 | + # Check if there'"'"'s a new revision |
| 50 | + if [ "$CURRENT_REV" != "$NEXT_REV" ]; then |
| 51 | + echo "new_revision=$NEXT_REV" >> $GITHUB_OUTPUT |
| 52 | + echo "current_revision=$CURRENT_REV" >> $GITHUB_OUTPUT |
| 53 | + echo "has_update=true" >> $GITHUB_OUTPUT |
| 54 | + else |
| 55 | + echo "has_update=false" >> $GITHUB_OUTPUT |
| 56 | + fi |
| 57 | +
|
| 58 | + echo "Current revision: $CURRENT_REV" |
| 59 | + echo "Next revision: $NEXT_REV" |
| 60 | + echo "Has update: ${{ steps.check-revision.outputs.has_update }}" |
| 61 | + ' |
| 62 | +
|
| 63 | + - name: Create update branch |
| 64 | + if: steps.check-revision.outputs.has_update == 'true' |
| 65 | + run: | |
| 66 | + # Create a new branch for the update |
| 67 | + BRANCH_NAME="update-temporal-to-${{ steps.check-revision.outputs.new_revision }}" |
| 68 | + git checkout -b "$BRANCH_NAME" |
| 69 | +
|
| 70 | + echo "Created branch: $BRANCH_NAME" |
| 71 | +
|
| 72 | + - name: Update Temporal revision |
| 73 | + if: steps.check-revision.outputs.has_update == 'true' |
| 74 | + run: | |
| 75 | + # Enter nix develop shell and run the update |
| 76 | + nix develop . --impure --accept-flake-config --command ' |
| 77 | + ./scripts/update-temporal-revision.sh ${{ steps.check-revision.outputs.new_revision }} |
| 78 | + ' |
| 79 | +
|
| 80 | + - name: Check for changes |
| 81 | + if: steps.check-revision.outputs.has_update == 'true' |
| 82 | + id: check-changes |
| 83 | + run: | |
| 84 | + # Check if there are any changes to commit |
| 85 | + if git diff --quiet; then |
| 86 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 87 | + echo "No changes detected" |
| 88 | + else |
| 89 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 90 | + echo "Changes detected" |
| 91 | + fi |
| 92 | +
|
| 93 | + - name: Commit and push changes |
| 94 | + if: steps.check-revision.outputs.has_update == 'true' && steps.check-changes.outputs.has_changes == 'true' |
| 95 | + run: | |
| 96 | + # Configure git |
| 97 | + git config --local user.email "[email protected]" |
| 98 | + git config --local user.name "GitHub Action" |
| 99 | +
|
| 100 | + # Add all changes |
| 101 | + git add . |
| 102 | +
|
| 103 | + # Commit with descriptive message |
| 104 | + git commit -m "Update Temporal SDK to revision ${{ steps.check-revision.outputs.new_revision }} |
| 105 | +
|
| 106 | + - Updated from ${{ steps.check-revision.outputs.current_revision }} to ${{ steps.check-revision.outputs.new_revision }} |
| 107 | + - Auto-generated by GitHub Actions |
| 108 | +
|
| 109 | + This PR updates the Temporal SDK dependencies to the next available revision." |
| 110 | +
|
| 111 | + # Push the branch |
| 112 | + git push origin "update-temporal-to-${{ steps.check-revision.outputs.new_revision }}" |
| 113 | +
|
| 114 | + - name: Create Pull Request |
| 115 | + if: steps.check-revision.outputs.has_update == 'true' && steps.check-changes.outputs.has_changes == 'true' |
| 116 | + uses: peter-evans/create-pull-request@v5 |
| 117 | + with: |
| 118 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + branch: "update-temporal-to-${{ steps.check-revision.outputs.new_revision }}" |
| 120 | + title: "Update Temporal SDK to revision ${{ steps.check-revision.outputs.new_revision }}" |
| 121 | + body: | |
| 122 | + ## Summary |
| 123 | +
|
| 124 | + This PR updates the Temporal SDK dependencies to revision `${{ steps.check-revision.outputs.new_revision }}`. |
| 125 | +
|
| 126 | + ## Changes |
| 127 | +
|
| 128 | + - **Previous revision:** `${{ steps.check-revision.outputs.current_revision }}` |
| 129 | + - **New revision:** `${{ steps.check-revision.outputs.new_revision }}` |
| 130 | +
|
| 131 | + ## What was updated |
| 132 | +
|
| 133 | + The following Temporal dependencies were updated: |
| 134 | + - `temporal-client` |
| 135 | + - `temporal-sdk-core` |
| 136 | + - `temporal-sdk-core-api` |
| 137 | + - `temporal-sdk-core-protos` |
| 138 | + - `rustfsm` |
| 139 | +
|
| 140 | + ## Auto-generated |
| 141 | +
|
| 142 | + This PR was automatically created by the [Auto-update Temporal SDK](/.github/workflows/auto-update-temporal.yml) workflow. |
| 143 | +
|
| 144 | + ## Testing |
| 145 | +
|
| 146 | + Please review the changes and run the test suite to ensure everything works correctly. |
| 147 | +
|
| 148 | + - [ ] Tests pass |
| 149 | + - [ ] Build succeeds |
| 150 | + - [ ] No breaking changes introduced |
| 151 | +
|
| 152 | + ## Related |
| 153 | +
|
| 154 | + - Temporal SDK Core: https://github.com/temporalio/sdk-core |
| 155 | + - Commit: https://github.com/temporalio/sdk-core/commit/${{ steps.check-revision.outputs.new_revision }} |
| 156 | + labels: | |
| 157 | + dependencies |
| 158 | + temporal |
| 159 | + auto-generated |
| 160 | + assignees: | |
| 161 | + # Add your GitHub username here if you want to be assigned to these PRs |
| 162 | + reviewers: | |
| 163 | + # Add reviewers here if desired |
| 164 | + draft: false |
| 165 | + delete-branch: false |
| 166 | + |
| 167 | + - name: Comment on existing PR |
| 168 | + if: steps.check-revision.outputs.has_update == 'true' && steps.check-changes.outputs.has_changes == 'false' |
| 169 | + run: | |
| 170 | + echo "No changes detected - the revision may already be up to date or the changes are minimal" |
| 171 | + # You could add logic here to comment on existing PRs if needed |
| 172 | +
|
| 173 | + - name: Log when no update is needed |
| 174 | + if: steps.check-revision.outputs.has_update == 'false' |
| 175 | + run: | |
| 176 | + echo "No new Temporal revision available" |
| 177 | + echo "Current revision is up to date" |
0 commit comments