Skip to content

Commit 1f4a916

Browse files
committed
Add tags mirror functionality
1 parent 871fb56 commit 1f4a916

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
args: "https://gitlab.com/<namespace>/<repository>"
2525
env:
26+
FOLLOW_TAGS: "false"
2627
FORCE_PUSH: "false"
2728
GITLAB_HOSTNAME: "gitlab.com"
2829
GITLAB_USERNAME: "svboxel"
@@ -37,3 +38,5 @@ The token must have `read_api`, `read_repository` & `write_repository` permissio
3738
For granular permissions create seperate users and tokens in GitLab with restricted access.
3839

3940
If you're rewriting history in the primary repo (e.g by using `git rebase`), you'll need to force push. Set the `FORCE_PUSH` environment variable to `true` to enable this. This will overwrite history in the mirror as well, so be **careful with this** (just like any time you're using `git push --force`).
41+
42+
If you want to mirror repository tags too, you can define `FOLLOW_TAGS` environment variable to `true`.

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ else
3838
sh -c "git push mirror $branch"
3939
fi
4040

41+
if [ "${FOLLOW_TAGS:-}" = "true" ]
42+
then
43+
sh -c "echo pushing with --tags"
44+
sh -c "git push --tags mirror $branch"
45+
fi
46+
4147
sleep $POLL_TIMEOUT
4248

4349
pipeline_id=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${branch_uri}" | jq '.last_pipeline.id')

0 commit comments

Comments
 (0)