-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2e0c4a
commit b497355
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Mirror | ||
|
||
on: [push, delete] | ||
|
||
jobs: | ||
mirror: | ||
if: ${{ github.repository == 'authgear/authgear-server' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# Set fetch-depth: 0 to fetch all history for all branches and tags. | ||
# https://github.com/actions/checkout#:~:text=Set%20fetch%2Ddepth%3A%200%20to%20fetch%20all%20history%20for%20all%20branches%20and%20tags. | ||
fetch-depth: 0 | ||
- name: Import GitHub Deploy Key of the mirror repository | ||
env: | ||
MIRROR_GITHUB_DEPLOY_KEY: ${{ secrets.MIRROR_GITHUB_DEPLOY_KEY_OURSKY }} | ||
run: | | ||
mkdir -p ~/.ssh | ||
printf "$MIRROR_GITHUB_DEPLOY_KEY" | base64 --decode > ~/.ssh/id_ed25519 | ||
chmod 600 ~/.ssh/id_ed25519 | ||
ssh-keygen -R github.com | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
- name: Mirror | ||
run: | | ||
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_ed25519" | ||
git remote add mirror [email protected]:oursky/authgear-server.git | ||
git push --tags --force --prune mirror "refs/remotes/origin/*:refs/heads/*" | ||
- name: Clean up | ||
if: ${{ always() }} | ||
run: | | ||
rm -f ~/.ssh/id_ed25519 | ||
git remote remove mirror |