-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: If icon files change, upadte lastUpdated in package.json (#51)
Co-authored-by: github-actions <[email protected]>
- Loading branch information
1 parent
dcff8b4
commit 9924960
Showing
3 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { execSync } from "child_process"; | ||
|
||
/** | ||
* Gets all files that have changed in the current branch | ||
* @returns string[] - List of files that have changed | ||
*/ | ||
const getAllChangedFiles = (): string[] => { | ||
const diffOutput = execSync(`git diff HEAD --name-only`).toString(); | ||
return diffOutput.toString().split("\n").filter(Boolean); | ||
}; | ||
|
||
/** | ||
* Stages all files in the current branch | ||
*/ | ||
export const stageAllFiles = (): void => { | ||
execSync(`git add .`); | ||
}; | ||
|
||
/** | ||
* Checks if any files have changed in the current branch, but removes package.json from the list of changed files | ||
* @returns boolean - Whether files have changed and the action should create a PR | ||
*/ | ||
export const checkForFileChanges = (): boolean => { | ||
stageAllFiles(); | ||
return getAllChangedFiles().length > 0; | ||
}; |