Skip to content

Commit f88f18c

Browse files
authored
[workflow] Update the changelog merge action to fetch the stable branch (flutter#183132)
The action to merge the changelog from stable to master was failing because it couldn't find the `stable` branch. This PR updates the action to explicitly fetch the `stable` branch and avoid a deep clone of all branches using `fetch-depth: 0` in `actions/checkout`.
1 parent daf264e commit f88f18c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/merge-changelog.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ jobs:
1414
pull-requests: write
1515

1616
steps:
17+
# defaults to `fetch-depth:1` which only checks out the current branch
18+
# since the action runs on master, it will only checkout master.
1719
- name: Setup Repository
1820
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1921
with:
20-
repository: ${{ github.repository }}
2122
ref: master
2223

24+
# avoid downloading hundreds of other branches/history
25+
# utilizing `fetch-depth:0` in actions/checkout would clone everything.
26+
- name: Fetch Stable Branch Only
27+
run: git fetch origin stable:stable --depth=1
28+
2329
- name: Configure git
2430
run: |
2531
git config user.name "[bot] Merge Changelog"
@@ -28,7 +34,9 @@ jobs:
2834
- name: Read CHANGELOG.md from the stable branch
2935
id: read_stable_changelog
3036
run: |
31-
CHANGELOG_CONTENT=$(git show origin/stable:CHANGELOG.md)
37+
# origin/stable is locally mapped to stable
38+
# use the local stable ref from above
39+
CHANGELOG_CONTENT=$(git show stable:CHANGELOG.md)
3240
echo "CHANGELOG_CONTENT<<EOF" >> $GITHUB_ENV
3341
echo "$CHANGELOG_CONTENT" >> $GITHUB_ENV
3442
echo "EOF" >> $GITHUB_ENV

0 commit comments

Comments
 (0)