Skip to content

Commit

Permalink
Authoring Fix CI (#1275)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rob1997 authored Jan 21, 2025
1 parent f02b652 commit 1882a05
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/reauthor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Re-author
on:
workflow_dispatch:
inputs:
previous_email:
required: true
description: 'Author to change (email)'
type: string
new_email:
required: true
description: 'New author email'
type: string
new_username:
required: true
description: 'New author username'
type: string

jobs:
reauthor:
name: Re-author job
runs-on: ubuntu-latest
steps:
- name: Set-up SSH
uses: MrSquaare/ssh-setup-action@v1
with:
host: github.com
private-key: ${{ secrets.DEPLOY_KEY }}
- name: Clone and Re-author
run: |
git clone --bare [email protected]:ChainSafe/web3.unity.git
cd web3.unity.git
git config user.email "$new_email"
git config user.name $new_username
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="$previous_email"
CORRECT_NAME="$new_username"
CORRECT_EMAIL="$new_email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
git push --force --tags origin 'refs/heads/*'
env:
previous_email: ${{ github.event.inputs.previous_email }}
new_email: ${{ github.event.inputs.new_email }}
new_username: ${{ github.event.inputs.new_username }}

0 comments on commit 1882a05

Please sign in to comment.