Skip to content

Commit 886cf74

Browse files
committed
sync-git-mailing-list-mirror: skip clone if possible
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 8ff03b7 commit 886cf74

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/sync-git-mailing-list-mirror.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ jobs:
2020
permissions:
2121
contents: write
2222
steps:
23+
- name: check if update is needed
24+
id: needs-update
25+
run: |
26+
set -x
27+
source="$(git ls-remote "$SOURCE_REPOSITORY" master)" &&
28+
target="$(git ls-remote https://github.com/"$TARGET_GITHUB_REPOSITORY" lore-$LORE_EPOCH)" &&
29+
echo "result=$(test "${source%% *}" = "${target%% *}" && echo false || echo true)" >>$GITHUB_OUTPUT
2330
- name: Partial clone
31+
if: steps.needs-update.outputs.result == 'true'
2432
run: |
2533
git clone --bare --depth=1 -b lore-$LORE_EPOCH --filter=blob:none https://github.com/$TARGET_GITHUB_REPOSITORY .
2634
- name: Update from lore.kernel.org
35+
if: steps.needs-update.outputs.result == 'true'
2736
run: |
2837
git fetch "$SOURCE_REPOSITORY" refs/heads/master:refs/heads/lore-$LORE_EPOCH
2938
- name: Push to mirror
39+
if: steps.needs-update.outputs.result == 'true'
3040
env:
3141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3242
run: |

0 commit comments

Comments
 (0)