Skip to content

Commit

Permalink
Use user's name and email to associate with commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Nov 27, 2024
1 parent 4ba8ddd commit 5fe71e1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/generate-er-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@ jobs:
- name: Generate ER-model
run: tox -e generate-er-model

- name: Get user information from Github API
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
echo "USER_INFO=$(gh api /users/${{ github.actor }})" >> "$GITHUB_ENV"
- name: Add, commit and push changes
run: |
git config user.email "[email protected]"
git config user.name "ER-model generator"
if [ ${{ fromJson(env.USER_INFO).email }} ]; then
git config user.email "${{ fromJson(env.USER_INFO).email }}"
else
git config user.email "${{ github.actor }}@users.noreply.github.com"
fi
git config user.name "${{ fromJson(env.USER_INFO).name || github.actor }}"
git add "docs/reference/img/ER_model.png"
git commit -m "Update ER model"
git push -u origin update-er-model-${{ github.run_number }}
Expand Down

0 comments on commit 5fe71e1

Please sign in to comment.