Skip to content

Commit e95a523

Browse files
committed
sync-mailing-list-mirror: configure the workflow via vars.CONFIG
The grand idea to use GitGitGadget for projects other than Git is to allow configuring it via a custom JSON that is stored as a repository variable. Let's do this. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7a190bc commit e95a523

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
- cron: "*/5 * * * *"
77

88
env:
9-
LORE_EPOCH: 1 # also adjust SOURCE_REPOSITORY
10-
SOURCE_REPOSITORY: https://lore.kernel.org/git/1 # LORE_EPOCH
11-
TARGET_GITHUB_REPOSITORY: gitgitgadget/git-mailing-list-mirror
9+
MIRROR_REF: ${{ fromJSON(vars.CONFIG).mailrepo.mirrorRef }}
10+
SOURCE_REPOSITORY: ${{ fromJSON(vars.CONFIG).mailrepo.url }}${{ fromJSON(vars.CONFIG).mailrepo.public_inbox_epoch }}
11+
TARGET_GITHUB_REPOSITORY: ${{ fromJSON(vars.CONFIG).mailrepo.owner }}/${{ fromJSON(vars.CONFIG).mailrepo.name }}
1212

1313
concurrency:
1414
group: sync-mailing-list-mirror
@@ -27,16 +27,16 @@ jobs:
2727
echo "org=${TARGET_GITHUB_REPOSITORY%%/*}" >>$GITHUB_OUTPUT &&
2828
echo "repo=${TARGET_GITHUB_REPOSITORY#*/}" >>$GITHUB_OUTPUT &&
2929
source="$(git ls-remote "$SOURCE_REPOSITORY" master)" &&
30-
target="$(git ls-remote https://github.com/"$TARGET_GITHUB_REPOSITORY" lore-$LORE_EPOCH)" &&
30+
target="$(git ls-remote https://github.com/"$TARGET_GITHUB_REPOSITORY" "$MIRROR_REF")" &&
3131
echo "result=$(test "${source%% *}" = "${target%% *}" && echo false || echo true)" >>$GITHUB_OUTPUT
3232
- name: Partial clone
3333
if: steps.needs-update.outputs.result == 'true'
3434
run: |
35-
git clone --bare --depth=1 -b lore-$LORE_EPOCH --filter=blob:none https://github.com/$TARGET_GITHUB_REPOSITORY .
35+
git clone --bare --depth=1 -b "${MIRROR_REF#refs/heads/}" --filter=blob:none https://github.com/$TARGET_GITHUB_REPOSITORY .
3636
- name: Update from lore.kernel.org
3737
if: steps.needs-update.outputs.result == 'true'
3838
run: |
39-
git fetch "$SOURCE_REPOSITORY" refs/heads/master:refs/heads/lore-$LORE_EPOCH
39+
git fetch "$SOURCE_REPOSITORY" refs/heads/master:"$MIRROR_REF"
4040
- name: obtain installation token
4141
if: steps.needs-update.outputs.result == 'true'
4242
uses: actions/create-github-app-token@v2
@@ -51,4 +51,4 @@ jobs:
5151
env:
5252
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
5353
run: |
54-
git push https://$GITHUB_ACTOR:[email protected]/$TARGET_GITHUB_REPOSITORY lore-$LORE_EPOCH
54+
git push https://$GITHUB_ACTOR:[email protected]/$TARGET_GITHUB_REPOSITORY "$MIRROR_REF"

0 commit comments

Comments
 (0)