Skip to content

Commit 589b0e0

Browse files
committed
chore: wip
1 parent f2e6988 commit 589b0e0

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

.github/workflows/buddy-update.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ permissions:
4040
actions: read
4141
checks: read
4242
statuses: read
43-
workflows: write
4443

4544
jobs:
4645
test-dependency-updates:

src/git/github-provider.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,23 @@ export class GitHubProvider implements GitProvider {
4646

4747
private async commitChangesWithGit(branchName: string, message: string, files: FileChange[]): Promise<void> {
4848
try {
49-
// Filter out workflow files if we detect permission issues
49+
// Filter out workflow files since they require special permissions
5050
const workflowFiles = files.filter(f => f.path.includes('.github/workflows/'))
5151
const nonWorkflowFiles = files.filter(f => !f.path.includes('.github/workflows/'))
5252

5353
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.`)
5555
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.`)
5657

57-
// If we have non-workflow files, try to commit just those
58+
// If we have non-workflow files, commit just those
5859
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...`)
6061
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
6466
}
6567
}
6668

@@ -147,21 +149,23 @@ export class GitHubProvider implements GitProvider {
147149

148150
private async commitChangesWithAPI(branchName: string, message: string, files: FileChange[]): Promise<void> {
149151
try {
150-
// Filter out workflow files if we detect permission issues
152+
// Filter out workflow files since they require special permissions
151153
const workflowFiles = files.filter(f => f.path.includes('.github/workflows/'))
152154
const nonWorkflowFiles = files.filter(f => !f.path.includes('.github/workflows/'))
153155

154156
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.`)
156158
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.`)
157160

158-
// If we have non-workflow files, try to commit just those
161+
// If we have non-workflow files, commit just those
159162
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...`)
161164
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
165169
}
166170
}
167171

0 commit comments

Comments
 (0)