-
Notifications
You must be signed in to change notification settings - Fork 39
69 lines (64 loc) · 2.58 KB
/
Copy pathlinearize_main.yaml
File metadata and controls
69 lines (64 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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-with-cache]
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