name: Create RC Branch on: schedule: - cron: "0 3 * * 5" timezone: "America/Los_Angeles" workflow_dispatch: permissions: {} jobs: create-rc-branch: name: Create RC Branch if: github.event_name != 'schedule' || github.repository == 'BerriAI/litellm' runs-on: ubuntu-latest permissions: contents: write outputs: version: ${{ steps.version.outputs.version }} steps: - name: Require main env: REF: ${{ github.ref }} run: | if [ "$REF" != "refs/heads/main" ]; then echo "::error::rc branches are cut from refs/heads/main only, got $REF" exit 1 fi - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Read release version id: version run: python3 .github/scripts/read_rc_version.py >> "$GITHUB_OUTPUT" - name: Create rc branch env: VERSION: ${{ steps.version.outputs.version }} uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const branchName = `rc/${process.env.VERSION}`; const ref = `heads/${branchName}`; const existing = await github.rest.git.getRef({ owner: context.repo.owner, repo: context.repo.repo, ref, }).catch((error) => { if (error.status === 404) { return null; } throw error; }); if (existing !== null) { core.setFailed(`Branch ${branchName} already exists at ${existing.data.object.sha}; leaving it untouched`); return; } await github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, ref: `refs/${ref}`, sha: context.sha, }); core.info(`Created branch ${branchName} at ${context.sha}`); linear-release: name: Move the Linear release to rc needs: create-rc-branch permissions: contents: read uses: ./.github/workflows/linear-release.yml with: rc_version: ${{ needs.create-rc-branch.outputs.version }} secrets: LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}