summaryrefslogtreecommitdiff
path: root/.github/workflows/linearize.yml
blob: a5bbe4008b48ee033fa1665b2e0b6268c89df813 (plain)
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
name: Linearize chapter history

on:
  push:
    branches:
      - main

jobs:
  linearize:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: main
          fetch-depth: 0 # Fetch the full history
      - name: Construct linear history and push to linear branch
        run: |
          git remote set-url origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
          git config user.name 'GitHub Action'
          git config user.email 'actions@github.com'
          .github/workflows/linearize.sh
          git remote add linear ./linear
          git fetch linear
          git checkout -b linear linear/main
          git remote remove linear
          git push -f origin refs/heads/linear 'refs/tags/linear-chapter*'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}