linearize_main #22
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: linearize_main | |
on: | |
schedule: | |
# GMT timezone. | |
- cron: '0 10 * * *' | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
trigger_linearize: | |
runs-on: [self-hosted, chrobalt-linux-runner] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Checkout rebase_tools | |
uses: actions/checkout@v4 | |
with: | |
ref: experimental/rebase_tools | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install rebase_tools | |
run: | | |
set -eux | |
pip install -r requirements.txt | |
- name: Setup Git | |
run: | | |
git config --global user.name "GitHub Release Automation" | |
git config --global user.email "github@google.com" | |
- name: Run linearize | |
run: | | |
set -eux | |
python main.py linearize --repo-path=${GITHUB_WORKSPACE} --source-branch=main --new-branch-name=automated/linear_main \ | |
--start-commit-ref="$(git rev-parse --verify post-chrobalt-tag)" --end-commit-ref="$(git rev-parse --verify origin/main)" | |
- name: Update automated/linear_main and commit map, extract m114 commits | |
run: | | |
set -eux | |
git push --force origin automated/linear_main:automated/linear_main | |
# Pull from experimental/rebase_tools incase something changed | |
git checkout experimental/rebase_tools | |
git fetch origin experimental/rebase_tools | |
git pull origin experimental/rebase_tools --rebase | |
# Create new commits json for m114 | |
python main.py commits --repo-path=${GITHUB_WORKSPACE} --source-branch=origin/automated/linear_main \ | |
--start-commit-ref="$(git rev-parse --verify post-chrobalt-tag)" --end-commit-ref="$(git rev-parse --verify origin/automated/linear_main)" \ | |
--output-file=${GITHUB_WORKSPACE}/automated_commits_m114.json | |
git add automated_commits_m114.json | |
git stash | |
git checkout experimental/rebase_tools | |
rm -rf automated_commits_m114.json | |
git checkout stash -- automated_commits_m114.json | |
git add --ignore-removal automated_commits_m114.json | |
if git diff --quiet --cached; then | |
echo "No changes detected. Nothing to update." | |
else | |
git commit -m "Linearization refresh on $(date +'%Y-%m-%d')." | |
git push --force origin experimental/rebase_tools:experimental/rebase_tools | |
fi |