-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.17 KB
/
mirror.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Mirror Main Branch and Tags
on:
push:
branches:
- master
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
- name: Push main branch and tags to mirror repo
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.BOT_EMAIL }}
GIT_COMMITTER_EMAIL: ${{ secrets.BOT_EMAIL }}
run: |
git remote add mirror "https://${{ secrets.BOT_TOKEN }}@github.com/Codeinwp/themeisle-sdk-lib"
# Reset to a single commit with no history
git config --global user.email ${{ secrets.BOT_EMAIL }}
git config --global user.name "pirate-bot"
git checkout master
git reset --soft $(git rev-list --max-parents=0 HEAD) # Go to the first commit, keeping changes
git commit --amend -m "new changes" # Create a single commit
# Push to the mirror repo, overwriting history
git push mirror master --force # Push only the master branch with new history
git push mirror --tags --force