build(deps): bump astral-sh/setup-uv from 7.6.0 to 8.0.0 in the github-actions group #43
Workflow file for this run
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: Branch Synchronization | |
| # After a release completes on main, sync main back to develop | |
| # so develop stays up to date with release commits (changelog, tags, etc.) | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync-main-to-develop: | |
| # Only run when a release PR is merged to main (primary repo only — no sync PRs on forks) | |
| if: | | |
| github.repository == 'pypa/setuptools-scm' && | |
| github.event.pull_request.merged == true && | |
| startsWith(github.event.pull_request.head.ref, 'release/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create PR main → develop | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| // Check if develop branch exists | |
| try { | |
| await github.rest.repos.getBranch({ owner, repo, branch: 'develop' }); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| console.log('develop branch does not exist, skipping'); | |
| return; | |
| } | |
| throw error; | |
| } | |
| // Check if main has commits that develop doesn't | |
| const { data: comparison } = await github.rest.repos.compareCommits({ | |
| owner, repo, base: 'develop', head: 'main' | |
| }); | |
| if (comparison.ahead_by === 0) { | |
| console.log('main has no new commits for develop, skipping'); | |
| return; | |
| } | |
| console.log(`main has ${comparison.ahead_by} commits not on develop`); | |
| // Check for existing sync PR | |
| const { data: existingPRs } = await github.rest.pulls.list({ | |
| owner, repo, state: 'open', | |
| head: `${owner}:main`, base: 'develop' | |
| }); | |
| if (existingPRs.length > 0) { | |
| console.log(`Sync PR already exists: #${existingPRs[0].number}`); | |
| return; | |
| } | |
| const pr = context.payload.pull_request; | |
| const body = [ | |
| '## Branch Synchronization', | |
| '', | |
| `Syncs release changes from \`main\` back to \`develop\` after merging ${pr.title}.`, | |
| '', | |
| 'This is an automated PR created by the branch-sync workflow.', | |
| 'Review and merge to keep `develop` up to date with `main`.' | |
| ].join('\n'); | |
| const { data: syncPR } = await github.rest.pulls.create({ | |
| owner, repo, | |
| title: `Sync: main → develop`, | |
| body: body, | |
| head: 'main', | |
| base: 'develop' | |
| }); | |
| console.log(`Created sync PR #${syncPR.number}`); | |
| await github.rest.issues.addLabels({ | |
| owner, repo, | |
| issue_number: syncPR.number, | |
| labels: ['sync'] | |
| }); | |
| // Try to enable auto-merge | |
| try { | |
| await github.graphql(` | |
| mutation($pullRequestId: ID!) { | |
| enablePullRequestAutoMerge(input: {pullRequestId: $pullRequestId, mergeMethod: MERGE}) { | |
| pullRequest { | |
| autoMergeRequest { | |
| enabledAt | |
| } | |
| } | |
| } | |
| } | |
| `, { pullRequestId: syncPR.node_id }); | |
| console.log('Auto-merge enabled'); | |
| } catch (error) { | |
| console.log('Could not enable auto-merge:', error.message); | |
| } |