Skip to content

Commit

Permalink
fix: Refactor git staging process to improve handling of ignored file…
Browse files Browse the repository at this point in the history
…s in run function
  • Loading branch information
iamvikshan committed Nov 22, 2024
1 parent e8e327b commit cccc015
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

All notable changes to this project will be documented in this file.


# [v1.1.4](https://github.com/vixshan/link-updater/compare/v1.1.3...v1.1.4) (2024-11-22)



## [1.1.4](https://github.com/vixshan/link-updater/compare/v1.1.3...v1.1.4) (2024-11-22)

### Bug Fixes

* Update CHANGELOG and improve Jest configuration; enhance git tracking for stashed files ([0051538](https://github.com/vixshan/link-updater/commit/0051538afc720d075cbc15a9f72cf56ec5317363))
- Update CHANGELOG and improve Jest configuration; enhance git tracking for stashed files
([0051538](https://github.com/vixshan/link-updater/commit/0051538afc720d075cbc15a9f72cf56ec5317363))

# [v1.1.3](https://github.com/vixshan/link-updater/compare/v1.1.2...v1.1.3) (2024-11-22)

Expand Down
17 changes: 10 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@ export async function run(): Promise<void> {
const tempGitignore = '.action-gitignore'
fs.writeFileSync(tempGitignore, 'package.json\nbun.lockb\n')

// Add all changes while respecting the temporary gitignore
await exec('git', [
'add',
'--all',
'--force',
`--exclude-from=${tempGitignore}`
])
// First, stage all changes
await exec('git', ['add', '--all'])

// Then, reset the files we want to ignore
if (fs.existsSync('package.json')) {
await exec('git', ['reset', 'HEAD', 'package.json'])
}
if (fs.existsSync('bun.lockb')) {
await exec('git', ['reset', 'HEAD', 'bun.lockb'])
}

const commitMsg = config.commitMsg || defaultConfigMsg

Expand Down

0 comments on commit cccc015

Please sign in to comment.