gitlab-mirror #5167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gitlab-mirror | |
on: | |
schedule: | |
# Runs every hour, on the hour | |
- cron: '0 * * * *' | |
# To be able to manually trigger the job from GitHub UI | |
workflow_dispatch: | |
permissions: | |
# Necessary to be able to push to the repo | |
contents: write | |
jobs: | |
mirror: | |
name: gitlab-mirror | |
concurrency: mirror # Only 1 mirror job needs to run at once | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Checks out the github repo, but crucially also sets up git auth. | |
repository: ${{ github.repository }} | |
path: target-repo | |
ref: main | |
- name: Push Mirror git | |
# This force pushes to main! Be sure you want to run this! | |
run: | | |
set -x | |
cd target-repo || exit 1 | |
git remote add gitlab https://git.gitlab.arm.com/tooling/lisa.git | |
function mirror() { | |
local ref=$1 | |
git fetch gitlab "$ref" && | |
git push -f origin "FETCH_HEAD:$ref" | |
} | |
mirror refs/heads/main | |
mirror refs/heads/release | |
# This is used as the source of commits to add on top of main to | |
# build the master branch content | |
mirror refs/heads/for-master | |
mirror refs/heads/master-force | |
mirror refs/heads/master | |
mirror refs/heads/preview-force | |
mirror refs/heads/preview |