You've already forked testing-go-code-with-postgres
mirror of
https://github.com/xorcare/testing-go-code-with-postgres.git
synced 2025-06-30 23:23:40 +02:00
Make Gitlab mirroring great again
The https mirroring is broken for some reason. Since I don't need to manually start CI anymore, I made mirroring via SSH.
This commit is contained in:
22
.github/workflows/gitlab.yml
vendored
22
.github/workflows/gitlab.yml
vendored
@ -1,25 +1,25 @@
|
|||||||
name: GitLab
|
name: GitLab
|
||||||
|
|
||||||
on: [ push ]
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mirror:
|
mirror:
|
||||||
name: Mirroring to GitLab
|
name: Mirroring to GitLab
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- uses: webfactory/ssh-agent@v0.9.0
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
- name: Mirror repository to Gitlab
|
- name: Mirror repository to Gitlab
|
||||||
run: |
|
run: |
|
||||||
set -e -x
|
set -e -x
|
||||||
git remote add gitlab "${{ vars.GITLAB_REPO }}"
|
ssh-keyscan -H "${{ vars.GITLAB_HOSTNAME }}" | tee -a ~/.ssh/known_hosts
|
||||||
git config --global url."https://${{ vars.GITLAB_USERNAME }}:${{ secrets.GITLAB_PUSH_TOKEN }}@gitlab.com".insteadOf https://gitlab.com
|
git remote add gitlab "${{ vars.GITLAB_REPO_SSH }}"
|
||||||
git push --force gitlab "$GITHUB_REF_NAME"
|
git push --force gitlab "$GITHUB_REF_NAME"
|
||||||
- name: Run GitLab CI
|
|
||||||
run: >
|
|
||||||
curl -i --fail
|
|
||||||
--request POST
|
|
||||||
--form token=${{ secrets.GITLAB_CI_TOKEN }}
|
|
||||||
--form ref="${{ github.ref_name }}"
|
|
||||||
https://gitlab.com/api/v4/projects/${{ vars.GITLAB_PROJECT_ID }}/trigger/pipeline
|
|
||||||
|
Reference in New Issue
Block a user