diff --git a/dist/index.js b/dist/index.js index 6be14c3..ed0f1fc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29248,7 +29248,8 @@ module.exports = { const eventDescriptions = { 'PushEvent': ({ repo, isPrivate, payload }) => { - const commitSha = payload.commits[0].sha; + console.log(payload) + const commitSha = payload.commits[0]?.sha; return isPrivate ? '📝 Committed to a private repo' : `📝 Committed to [${repo.name}](https://github.com/${repo.name}/commit/${commitSha})`; @@ -29545,10 +29546,6 @@ async function updateReadme(activity) { return; } - // Write updated content to README.md - fs.writeFileSync(readmePath, updatedContent, 'utf-8'); - core.notice('✅ README.md updated successfully!'); - if (process.env.ACT) { core.debug('🚧 Act-Debug mode enabled)') console.log(activity); @@ -29591,6 +29588,8 @@ async function updateReadme(activity) { }] }); + core.notice('✅ README.md updated successfully!'); + // Create a new commit with the author set to github-actions[bot] const { data: newCommit } = await octokit.rest.git.createCommit({ owner, @@ -31702,7 +31701,8 @@ async function main() { const activity = await fetchAndFilterEvents({ username, token, eventLimit, ignoreEvents }); await updateReadme(activity, readmePath); } catch (error) { - core.setFailed('❌ Error in the update process:', error); + core.setFailed(`❌ Error in the update process: ${error.message}`); + console.error(error) process.exit(1); } } diff --git a/src/index.js b/src/index.js index 1481afc..e42e1d0 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,8 @@ async function main() { const activity = await fetchAndFilterEvents({ username, token, eventLimit, ignoreEvents }); await updateReadme(activity, readmePath); } catch (error) { - core.setFailed('❌ Error in the update process:', error); + core.setFailed(`❌ Error in the update process: ${error.message}`); + console.error(error) process.exit(1); } } diff --git a/src/utils/eventDescriptions.js b/src/utils/eventDescriptions.js index f0837d2..ca5b151 100644 --- a/src/utils/eventDescriptions.js +++ b/src/utils/eventDescriptions.js @@ -1,6 +1,6 @@ const eventDescriptions = { 'PushEvent': ({ repo, isPrivate, payload }) => { - const commitSha = payload.commits[0].sha; + const commitSha = payload.commits[0]?.sha; return isPrivate ? '📝 Committed to a private repo' : `📝 Committed to [${repo.name}](https://github.com/${repo.name}/commit/${commitSha})`;