Skip to content

Commit 9bfe918

Browse files
Merge pull request #11 from santoshyadavdev/user-user-name-and-email-for-commit
user users name and email for commit
2 parents 406ed85 + 00710d0 commit 9bfe918

File tree

5 files changed

+12
-23
lines changed

5 files changed

+12
-23
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
with:
3737
allow-add-to-readme: 'false' # Default value, set to 'true' to enable README updates
3838
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} # do not use GITHUB_TOKEN as it lacks the permission to call graphql APIs, create a new Personal Access TOKEN and provide read:org access to read to sponsorship data
4040
```
4141
4242
### Readme Integration
@@ -53,14 +53,12 @@ appear:
5353
The action will automatically insert sponsorship data between these markers in
5454
the format:
5555

56-
- @username: 5 USD
57-
- @sponsor2: 10 USD
56+
- @username-1: 5 USD
57+
- @username-2: 10 USD
5858

5959
### Inputs
6060

61-
GH_USERNAME: Your GitHub username (default: ${{ github.repository_owner }})
62-
COMMIT_NAME: Name of the committer (default: github-actions[bot]) COMMIT_EMAIL:
63-
Email of the committer (default: github-actions[bot]@users.noreply.github.com)
61+
1. GH_USERNAME: Your GitHub username (default: ${{ github.repository_owner }})
6462

6563
## Initial Setup
6664

action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@ inputs:
1515
description: 'Your GitHub username'
1616
default: ${{ github.repository_owner }}
1717
required: false
18-
COMMIT_NAME:
19-
description: 'Name of the committer'
20-
default: 'github-actions[bot]'
21-
required: false
22-
COMMIT_EMAIL:
23-
description: 'Email of the committer'
24-
default: 'github-actions[bot]@users.noreply.github.com'
25-
required: false
2618
allow-add-to-readme:
2719
description: 'Add sponsorship data to README.md'
2820
required: false

dist/index.js

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import * as fs from 'fs'
77

88
// Get config
99
const GH_USERNAME = core.getInput('GH_USERNAME')
10-
const COMMIT_NAME = core.getInput('COMMIT_NAME')
11-
const COMMIT_EMAIL = core.getInput('COMMIT_EMAIL')
1210
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
1311

1412
interface SponsoredProfile {
@@ -86,8 +84,10 @@ async function commitIfNotDuplicate(
8684
fs.writeFileSync(fileUpdate.path, fileUpdate.content, 'utf8')
8785
execSync(`git add ${fileUpdate.path}`)
8886
}
89-
execSync(`git config --global user.name "${COMMIT_NAME}"`)
90-
execSync(`git config --global user.email "${COMMIT_EMAIL}"`)
87+
88+
const { data: user } = await octokit.request('GET /user')
89+
execSync(`git config --global user.name "${user.name}"`)
90+
execSync(`git config --global user.email "${user.email}"`)
9191
execSync(`git commit --allow-empty -m "${commitMessage}"`)
9292
execSync('git push')
9393
} else {

0 commit comments

Comments
 (0)