Skip to content

Commit e83be84

Browse files
authored
Authoring Fix CI (#1275)
* initial commit * added git username and email * use ssh instead * added ssh key * add private key as text * reverted ssh changes * use third party actions to setup ssh * push in a separate step * log old author commit * use original email instead of obscured one for GitHub * moved push back into first step * use input for referencing emails and usernames removed testing triggers * removed push trigger * changed repo url for testing on main * reverted url changes made for testing
1 parent 7a73dfa commit e83be84

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/reauthor.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Re-author
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
previous_email:
6+
required: true
7+
description: 'Author to change (email)'
8+
type: string
9+
new_email:
10+
required: true
11+
description: 'New author email'
12+
type: string
13+
new_username:
14+
required: true
15+
description: 'New author username'
16+
type: string
17+
18+
jobs:
19+
reauthor:
20+
name: Re-author job
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Set-up SSH
24+
uses: MrSquaare/ssh-setup-action@v1
25+
with:
26+
host: github.com
27+
private-key: ${{ secrets.DEPLOY_KEY }}
28+
- name: Clone and Re-author
29+
run: |
30+
git clone --bare [email protected]:ChainSafe/web3.unity.git
31+
32+
cd web3.unity.git
33+
34+
git config user.email "$new_email"
35+
36+
git config user.name $new_username
37+
38+
#!/bin/sh
39+
40+
git filter-branch -f --env-filter '
41+
OLD_EMAIL="$previous_email"
42+
CORRECT_NAME="$new_username"
43+
CORRECT_EMAIL="$new_email"
44+
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
45+
then
46+
export GIT_COMMITTER_NAME="$CORRECT_NAME"
47+
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
48+
fi
49+
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
50+
then
51+
export GIT_AUTHOR_NAME="$CORRECT_NAME"
52+
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
53+
fi
54+
' --tag-name-filter cat -- --branches --tags
55+
git push --force --tags origin 'refs/heads/*'
56+
env:
57+
previous_email: ${{ github.event.inputs.previous_email }}
58+
new_email: ${{ github.event.inputs.new_email }}
59+
new_username: ${{ github.event.inputs.new_username }}

0 commit comments

Comments
 (0)