mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
workflows/sync-default-branches: force push instead of force-with-lease.
Force-with-lease doesn't work as expected with a shallow clone.
This commit is contained in:
parent
e42084dc6f
commit
f89387ac39
13
.github/workflows/sync-default-branches.yml
vendored
13
.github/workflows/sync-default-branches.yml
vendored
@ -45,19 +45,20 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
|
|
||||||
- name: Setup target branch
|
- name: Get target SHA
|
||||||
|
id: sha
|
||||||
run: |
|
run: |
|
||||||
git checkout "${TARGET_BRANCH}" || git checkout -b "${TARGET_BRANCH}"
|
TARGET_SHA=$(git ls-remote origin "refs/heads/${SOURCE_BRANCH}" | cut -f1)
|
||||||
git reset --hard "origin/${SOURCE_BRANCH}"
|
echo "target=${TARGET_SHA}" >> "$GITHUB_OUTPUT"
|
||||||
env:
|
env:
|
||||||
SOURCE_BRANCH: ${{ steps.branches.outputs.source }}
|
SOURCE_BRANCH: ${{ steps.branches.outputs.source }}
|
||||||
TARGET_BRANCH: ${{ steps.branches.outputs.target }}
|
|
||||||
|
|
||||||
- name: Push target branch
|
- name: Push target branch
|
||||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
||||||
run: git push origin "${TARGET_BRANCH}" --force-with-lease
|
run: git push origin "${TARGET_SHA}:refs/heads/${TARGET_BRANCH}" --force
|
||||||
env:
|
env:
|
||||||
|
TARGET_SHA: ${{ steps.sha.outputs.target }}
|
||||||
TARGET_BRANCH: ${{ steps.branches.outputs.target }}
|
TARGET_BRANCH: ${{ steps.branches.outputs.target }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user