Sync Main Branch Into Stable Branch #2440
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Main Branch Into Stable Branch | |
| on: | |
| schedule: | |
| # Run every 2 hours | |
| - cron: '0 */2 * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| sync_main_into_stable: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App Token | |
| id: generate-token | |
| uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 | |
| with: | |
| app-id: ${{ secrets.ODH_RELEASE_BOT_APP_ID }} | |
| private-key: ${{ secrets.ODH_RELEASE_BOT_PRIVATE_KEY }} | |
| - name: Get GitHub App User ID | |
| id: get-user-id | |
| run: echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| - run: | | |
| git config --global user.name '${{ steps.generate-token.outputs.app-slug }}[bot]' | |
| git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate-token.outputs.app-slug }}[bot]@users.noreply.github.com' | |
| - name: Checkout repository | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| fetch-depth: 0 | |
| ref: stable | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Update main commits into stable | |
| id: update_main_into_stable | |
| run: | | |
| git fetch origin main stable | |
| git merge --ff-only origin/main | |
| git push origin stable |