|
| 1 | +name: linearize_main |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # GMT timezone. |
| 6 | + - cron: '0 10 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: read-all |
| 10 | + |
| 11 | +jobs: |
| 12 | + trigger_linearize: |
| 13 | + # runs-on: ubuntu-latest |
| 14 | + runs-on: [self-hosted, chrobalt-linux-runner] |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + steps: |
| 18 | + - name: Checkout main |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + ref: main |
| 22 | + fetch-depth: 6 |
| 23 | + - name: Checkout rebase_tools |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + ref: experimental/rebase_tools |
| 27 | + - uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: '3.9' |
| 30 | + cache: 'pip' |
| 31 | + - name: Install rebase_tools |
| 32 | + run: | |
| 33 | + set -eux |
| 34 | + pip install -r requirements.txt |
| 35 | + - name: Setup Git |
| 36 | + run: | |
| 37 | + git config --global user.name "GitHub Release Automation" |
| 38 | + git config --global user.email "github@google.com" |
| 39 | + - name: Run linearize |
| 40 | + run: | |
| 41 | + set -eux |
| 42 | + # m114 merge commit=38a06fe8674ad2140ff85c87b5b3a817304e369a |
| 43 | + # test merge commit=1c94965e70428e8415ea1b0813ad93a4e6067e81 |
| 44 | + export REV=$(git rev-parse --verify origin/main) |
| 45 | + # This will |
| 46 | + python main.py linearize --repo-path=${GITHUB_WORKSPACE} --source-branch=main --new-branch-name=feature/linear_main \ |
| 47 | + --start-commit-ref=1c94965e70428e8415ea1b0813ad93a4e6067e81 --end-commit-ref=${REV} --commit-output="${GITHUB_WORKSPACE}/linear_main_commit_mapping.json" |
| 48 | + - name: Update feature/linear_main and commit map |
| 49 | + run: | |
| 50 | + set -eux |
| 51 | + git push --force origin feature/linear_main:feature/linear_main |
| 52 | + git add linear_main_commit_mapping.json |
| 53 | + git stash push -- linear_main_commit_mapping.json |
| 54 | + git checkout experimental/rebase_tools |
| 55 | + git stash pop |
| 56 | + git add linear_main_commit_mapping.json |
| 57 | + git commit -m "Linearization refresh on $(date +'%Y-%m-%d')." |
| 58 | + git push --force origin experimental/rebase_tools:experimental/rebase_tools |
0 commit comments