Skip to content

Commit 3d7bddd

Browse files
update build
1 parent 13dc4e4 commit 3d7bddd

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

dist/index.js

Lines changed: 9 additions & 6 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: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { graphql } from '@octokit/graphql'
55
import { execSync } from 'child_process'
66
import { Octokit } from '@octokit/rest'
77

8+
// Get config
9+
const GH_USERNAME = core.getInput('GH_USERNAME')
10+
const COMMIT_NAME = core.getInput('COMMIT_NAME')
11+
const COMMIT_EMAIL = core.getInput('COMMIT_EMAIL')
812
const token = process.env.GITHUB_TOKEN
913
const octokit = new Octokit({ auth: token })
1014

@@ -57,7 +61,7 @@ async function fetchSponsoredProfiles(): Promise<SponsoredProfile[]> {
5761

5862
return sponsoredProfiles
5963
} catch (error: any) {
60-
core.setFailed('Error fetching sponsored profiles:', error.message)
64+
core.setFailed(`Error fetching sponsored profiles: ${error.message}`)
6165
return []
6266
}
6367
}
@@ -67,10 +71,9 @@ async function commitIfNotDuplicate(commitMessage: string, filePath: string) {
6771
if (!repo) {
6872
throw new Error('GITHUB_REPOSITORY is not defined')
6973
}
70-
const owner = repo.split('/')
7174

7275
const { data: commits } = await octokit.repos.listCommits({
73-
owner,
76+
owner: GH_USERNAME,
7477
repo,
7578
per_page: 100
7679
})
@@ -81,10 +84,8 @@ async function commitIfNotDuplicate(commitMessage: string, filePath: string) {
8184

8285
if (!duplicateCommit) {
8386
// Commit the changes
84-
execSync('git config --global user.name "github-actions[bot]"')
85-
execSync(
86-
'git config --global user.email "github-actions[bot]@users.noreply.github.com"'
87-
)
87+
execSync(`git config --global user.name "${COMMIT_NAME}"`)
88+
execSync(`git config --global user.email "${COMMIT_EMAIL}"`)
8889
execSync(`git add ${filePath}`)
8990
execSync(`git commit -m "${commitMessage}"`)
9091
execSync('git push')
@@ -115,7 +116,7 @@ export async function run(): Promise<void> {
115116
const filePath = `${year}/${month}/sponsoredProfile_${profile.sponsorLogin}.json`
116117
fs.writeFileSync(filePath, JSON.stringify(profile, null, 2))
117118

118-
const commitMessage = `${profile.sponsorshipAmount} ${profile.currency} sponsorship paid to @${profile.sponsorLogin} for ${month} ${year}`
119+
const commitMessage = `${profile.sponsorshipAmount} ${profile.currency} paid to @${profile.sponsorLogin} for ${month} ${year} to support open source.`
119120

120121
await commitIfNotDuplicate(commitMessage, filePath)
121122
})

0 commit comments

Comments
 (0)