@@ -46,21 +46,23 @@ export class GitHubProvider implements GitProvider {
46
46
47
47
private async commitChangesWithGit ( branchName : string , message : string , files : FileChange [ ] ) : Promise < void > {
48
48
try {
49
- // Filter out workflow files if we detect permission issues
49
+ // Filter out workflow files since they require special permissions
50
50
const workflowFiles = files . filter ( f => f . path . includes ( '.github/workflows/' ) )
51
51
const nonWorkflowFiles = files . filter ( f => ! f . path . includes ( '.github/workflows/' ) )
52
52
53
53
if ( workflowFiles . length > 0 ) {
54
- console . warn ( `⚠️ Detected ${ workflowFiles . length } workflow file(s). These require 'workflows' permission .` )
54
+ console . warn ( `⚠️ Detected ${ workflowFiles . length } workflow file(s). These require elevated permissions .` )
55
55
console . warn ( `⚠️ Workflow files: ${ workflowFiles . map ( f => f . path ) . join ( ', ' ) } ` )
56
+ console . warn ( `ℹ️ Workflow files will be skipped in this commit. Consider using a GitHub App with workflow permissions for workflow updates.` )
56
57
57
- // If we have non-workflow files, try to commit just those
58
+ // If we have non-workflow files, commit just those
58
59
if ( nonWorkflowFiles . length > 0 ) {
59
- console . log ( `📝 Attempting to commit ${ nonWorkflowFiles . length } non-workflow files only ...` )
60
+ console . log ( `📝 Committing ${ nonWorkflowFiles . length } non-workflow files...` )
60
61
files = nonWorkflowFiles
61
- }
62
- else {
63
- throw new Error ( 'All files are workflow files but GitHub App lacks workflows permission. Please add "workflows: write" permission to the GitHub App.' )
62
+ } else {
63
+ console . warn ( `⚠️ All files are workflow files. No files will be committed in this PR.` )
64
+ console . warn ( `💡 To update workflow files, consider using a GitHub App with appropriate permissions.` )
65
+ return // Exit early if no non-workflow files to commit
64
66
}
65
67
}
66
68
@@ -147,21 +149,23 @@ export class GitHubProvider implements GitProvider {
147
149
148
150
private async commitChangesWithAPI ( branchName : string , message : string , files : FileChange [ ] ) : Promise < void > {
149
151
try {
150
- // Filter out workflow files if we detect permission issues
152
+ // Filter out workflow files since they require special permissions
151
153
const workflowFiles = files . filter ( f => f . path . includes ( '.github/workflows/' ) )
152
154
const nonWorkflowFiles = files . filter ( f => ! f . path . includes ( '.github/workflows/' ) )
153
155
154
156
if ( workflowFiles . length > 0 ) {
155
- console . warn ( `⚠️ Detected ${ workflowFiles . length } workflow file(s). These require 'workflows' permission .` )
157
+ console . warn ( `⚠️ Detected ${ workflowFiles . length } workflow file(s). These require elevated permissions .` )
156
158
console . warn ( `⚠️ Workflow files: ${ workflowFiles . map ( f => f . path ) . join ( ', ' ) } ` )
159
+ console . warn ( `ℹ️ Workflow files will be skipped in this commit. Consider using a GitHub App with workflow permissions for workflow updates.` )
157
160
158
- // If we have non-workflow files, try to commit just those
161
+ // If we have non-workflow files, commit just those
159
162
if ( nonWorkflowFiles . length > 0 ) {
160
- console . log ( `📝 Attempting to commit ${ nonWorkflowFiles . length } non-workflow files only ...` )
163
+ console . log ( `📝 Committing ${ nonWorkflowFiles . length } non-workflow files...` )
161
164
files = nonWorkflowFiles
162
- }
163
- else {
164
- throw new Error ( 'All files are workflow files but GitHub App lacks workflows permission. Please add "workflows: write" permission to the GitHub App.' )
165
+ } else {
166
+ console . warn ( `⚠️ All files are workflow files. No files will be committed in this PR.` )
167
+ console . warn ( `💡 To update workflow files, consider using a GitHub App with appropriate permissions.` )
168
+ return // Exit early if no non-workflow files to commit
165
169
}
166
170
}
167
171
0 commit comments