Fix author information on PR branch of OdysseyHeaders

This commit is contained in:
MonsterDruide1 2024-02-27 22:53:35 +01:00
parent 6ef7f34c47
commit b2a5c1870b
2 changed files with 27 additions and 8 deletions

View File

@ -12,9 +12,9 @@ cd "./OdysseyHeaders"
echo "Open root of OdysseyHeaders repo"
git add -A .
git config user.name $COMMIT_AUTHOR_NAME
git config user.email $COMMIT_AUTHOR_MAIL
git commit -am "$COMMIT_MESSAGE"
git config user.name $AUTHOR_NAME
git config user.email $AUTHOR_MAIL
git commit -am "$MESSAGE"
git push -f -u origin $HEADER_BRANCH
echo "Updated headers successfully pushed to OdysseyHeaders repo"

View File

@ -35,12 +35,35 @@ jobs:
if [[ $GITHUB_EVENT_NAME == 'pull_request_target' ]]
then
echo "HEADER_BRANCH=pr-$PR_NUM" >> "$GITHUB_ENV"
if [[ $PR_AUTHOR_NAME != '' ]]
then
echo "AUTHOR_NAME=$PR_AUTHOR_NAME" >> "$GITHUB_ENV"
else
echo "AUTHOR_NAME=$PR_AUTHOR_LOGIN" >> "$GITHUB_ENV"
fi
if [[ $PR_AUTHOR_MAIL != '' ]]
then
echo "AUTHOR_MAIL=$PR_AUTHOR_MAIL"
else
echo "AUTHOR_MAIL=$PR_AUTHOR_LOGIN@noreply.github.com" >> "$GITHUB_ENV"
fi
echo "MESSAGE=$PR_TITLE"
else
echo "HEADER_BRANCH=$DELETED_BRANCH" >> "$GITHUB_ENV"
echo "AUTHOR_NAME=$COMMIT_AUTHOR_NAME" >> "$GITHUB_ENV"
echo "AUTHOR_MAIL=$COMMIT_AUTHOR_MAIL" >> "$GITHUB_ENV"
echo "MESSAGE=$COMMIT_MESSAGE" >> "$GITHUB_ENV"
fi
env:
DELETED_BRANCH: ${{ github.event.ref }}
PR_NUM: ${{ github.event.number }}
PR_NUM: ${{ github.event.pull_request.number }}
COMMIT_AUTHOR_NAME: ${{ github.event.commits[0].author.name }}
COMMIT_AUTHOR_MAIL: ${{ github.event.commits[0].author.email }}
COMMIT_MESSAGE: ${{ github.event.commits[0].message }}
PR_AUTHOR_NAME: ${{ github.event.pull_request.user.name }}
PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }}
PR_AUTHOR_MAIL: ${{ github.event.pull_request.user.email }}
PR_TITLE: ${{ github.event.pull_request.title }}
- name: Move to correct branch of OdysseyHeaders and reset history
run: |
cd OdysseyHeaders
@ -52,7 +75,3 @@ jobs:
DESTINATION_PATH: ./OdysseyHeaders
- name: Push to OdysseyHeaders repo
run: bash ./.github/scripts/push-headers.sh
env:
COMMIT_AUTHOR_NAME: ${{ github.event.commits[0].author.name }}
COMMIT_AUTHOR_MAIL: ${{ github.event.commits[0].author.email }}
COMMIT_MESSAGE: ${{ github.event.commits[0].message }}