├── .github ├── dependabot.yml ├── renovate.json └── workflows │ ├── test.yml │ ├── check.yml │ └── build.yml ├── entrypoint.sh ├── action.yml ├── license.md └── readme.md /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | ":disableDependencyDashboard" 6 | ], 7 | "forkProcessing": "enabled" 8 | } 9 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | paths: 4 | - '**/*.sh' 5 | - '.github/workflows/test.yml' 6 | - '.github/workflows/check.yml' 7 | 8 | name: "Test" 9 | permissions: {} 10 | 11 | jobs: 12 | shellcheck: 13 | uses: ./.github/workflows/check.yml 14 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | on: [workflow_call] 2 | name: "Check" 3 | permissions: {} 4 | 5 | jobs: 6 | shellcheck: 7 | name: shellcheck 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v5 11 | - name: Run ShellCheck 12 | uses: ludeeus/action-shellcheck@master 13 | env: 14 | SHELLCHECK_OPTS: -x 15 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | echo "${GITHUB_EVENT_NAME}" 5 | 6 | function git-setup() { 7 | printf -v url "https://%s:%s@%s" \ 8 | "${INPUT_TARGET_USERNAME}" \ 9 | "${INPUT_TARGET_TOKEN}" \ 10 | "${INPUT_TARGET_URL#https://}" 11 | echo "git remote add target ${url}" 12 | git remote add target "${url}" 13 | set -x 14 | } 15 | 16 | case "${GITHUB_EVENT_NAME}" in 17 | push|create|pull_request|workflow_dispatch|workflow_run) 18 | git-setup 19 | git fetch --all 20 | git push -f --all target 21 | git push -f --prune target 22 | git push -f --tags target 23 | ;; 24 | delete) 25 | git-setup 26 | git push -d target "${GITHUB_EVENT_REF}" 27 | ;; 28 | *) 29 | #break 30 | esac 31 | 32 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Gitlab Sync" 2 | author: "action-pack" 3 | description: "Action to mirror a repository to GitLab." 4 | 5 | branding: 6 | icon: "copy" 7 | color: "gray-dark" 8 | 9 | inputs: 10 | url: 11 | description: "GitLab repo URL" 12 | required: true 13 | username: 14 | description: "GitLab username" 15 | required: true 16 | token: 17 | description: "GitLab token" 18 | required: true 19 | runs: 20 | using: "composite" 21 | steps: 22 | - run: ${{ github.action_path }}/entrypoint.sh 23 | shell: bash 24 | env: 25 | INPUT_TARGET_URL: ${{ inputs.url }} 26 | INPUT_TARGET_TOKEN: ${{ inputs.token }} 27 | INPUT_TARGET_USERNAME: ${{ inputs.username }} 28 | GITHUB_EVENT_REF: ${{ github.event.ref }} 29 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |