Skip to content

Commit 24fb2b7

Browse files
committed
Updated to get git username
1 parent 46d6073 commit 24fb2b7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/event-logger.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ jobs:
4444
run: |
4545
echo $COMMITS > commits.json
4646
cat commits.json # debugging
47+
GIT_USERNAME=$(jq -r '.[0].commit.author.name' commits.json) # Extract Git username
48+
echo "Git Username: $GIT_USERNAME"
4749
pipenv run gitcommitlogger -r $(echo $REPOSITORY_URL) -t pull_request_merged -d $(echo $PR_CLOSED_AT) -un $(echo $GITHUB_LOGIN) -i commits.json -o commit_stats.csv -u $(echo $COMMIT_LOG_API) -v
50+
echo "GIT_USERNAME=$GIT_USERNAME" >> $GITHUB_ENV # Pass it to the next steps
4851
- name: Log pull request closed without merge
4952
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false
5053
run: |

.github/workflows/hook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
EVENT_TYPE: ${{ github.event_name }}
3232
EMAIL: ${{ secrets.EMAIL }}
3333
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
34+
GIT_USERNAME: ${{ env.GIT_USERNAME }}
3435
run: |
3536
node -e "
3637
const nodemailer = require('nodemailer');
@@ -49,7 +50,8 @@ jobs:
4950
text: \`Event Type: ${{ github.event_name }}\n
5051
GitHub Event: ${{ env.GITHUB_EVENT }}\n
5152
GitHub Actor: ${{ env.GITHUB_ACTOR }}\n
52-
GitHub User: ${{ env.GITHUB_USER }}\`
53+
GitHub User: ${{ env.GITHUB_USER }}\n
54+
Git User (Git Username from commit): ${process.env.GIT_USERNAME}\`
5355
};
5456
5557
transporter.sendMail(mailOptions, (error, info) => {

0 commit comments

Comments
 (0)