Skip to content

Commit c45f76b

Browse files
committed
small changes
1 parent df2ed19 commit c45f76b

File tree

9 files changed

+16
-20
lines changed

9 files changed

+16
-20
lines changed

.github/workflows/fanex-id-bot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ jobs:
2323
with:
2424
github-token: ${{ secrets.GITHUB_TOKEN }}
2525
enabled: true
26-

.github/workflows/housekeeping.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,3 @@ jobs:
6969
}
7070
}
7171
console.log(`Deleted ${deletedCount} orphaned caches`);
72-

.github/workflows/pr-assistant.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,3 @@ jobs:
8686
repo: context.repo.repo,
8787
body: `🎉 **Thank you @${author}!**\n\nYour contribution to the **faneX-ID GitHub Bot** repository is valuable! 🚀`
8888
});
89-

.github/workflows/pr-autofix.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ jobs:
3939
git commit -m "style: auto-fix linting issues [skip ci]"
4040
git push origin HEAD:${{ github.head_ref }}
4141
fi
42-

.github/workflows/pr-thanks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ jobs:
2525
repo: context.repo.repo,
2626
body: `🎉 **Thank you @${author}!**\n\nYour contribution to the **faneX-ID GitHub Bot** repository is valuable! 🚀`
2727
})
28-

.github/workflows/pr-validation.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ jobs:
7373
body: "❌ **PR Validation Failed**\n\nPlease check the logs and fix the issues."
7474
});
7575
}
76-

bot.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ def __init__(self, github_token: str, repo_name: str):
3131
self.github = Github(github_token)
3232
self.repo = self.github.get_repo(repo_name)
3333
self.repo_name = repo_name
34-
34+
3535
# Load configuration
3636
self.config = self._load_config()
37-
37+
3838
# Get retryable workflows for this repository
3939
self.retryable_workflows = self.config.get('retryable_workflows', {}).get(
40-
repo_name,
40+
repo_name,
4141
self.config.get('retryable_workflows', {}).get('default', [])
4242
)
43-
43+
4444
self.workflow_manager = WorkflowManager(self.github, repo_name, self.retryable_workflows)
4545
self.comment_handler = CommentHandler(self.repo)
46-
46+
4747
def _load_config(self) -> dict:
4848
"""Load bot configuration from config.yaml or fetch from main repo."""
4949
# Try to load local config first
@@ -56,11 +56,11 @@ def _load_config(self) -> dict:
5656
return config
5757
except Exception:
5858
pass
59-
59+
6060
# Fallback: fetch from main repository
6161
main_repo = 'faneX-ID/core'
6262
main_branch = 'main'
63-
63+
6464
try:
6565
config_url = f"https://raw.githubusercontent.com/{main_repo}/{main_branch}/github-bot/config.yaml"
6666
response = requests.get(config_url, timeout=10)
@@ -70,7 +70,7 @@ def _load_config(self) -> dict:
7070
return config
7171
except Exception as e:
7272
print(f"Could not fetch config from main repo: {e}")
73-
73+
7474
# Default config
7575
return {
7676
'enabled': True,
@@ -228,10 +228,10 @@ def _test_command(self, pr, commenter: str) -> str:
228228
# Check permissions
229229
admin_users = self.config.get('admin_users', [])
230230
admin_only_commands = self.config.get('admin_only_commands', [])
231-
231+
232232
if 'test' in admin_only_commands and commenter not in admin_users:
233233
return f"❌ Only admins can use `/test`. Admins: {', '.join(admin_users)}"
234-
234+
235235
try:
236236
# Get available workflows from config or use defaults
237237
workflows_to_trigger = self.retryable_workflows[:5] if self.retryable_workflows else []

requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Formatting tools for GitHub bot and CI workflows
2+
black>=24.0.0
3+
isort>=5.13.0
14
PyGithub>=2.0.0
2-
requests>=2.31.0
3-
pyyaml>=6.0
5+
PyYAML>=6.0.0

workflow_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def retry_workflow(self, sha: str, workflow_name: str) -> bool:
102102
# Check if workflow is retryable
103103
if self.retryable_workflows and workflow_name not in self.retryable_workflows:
104104
return False
105-
105+
106106
try:
107107
# Get workflow runs for this commit
108108
runs = self.repo.get_workflow_runs(head_sha=sha)
@@ -139,7 +139,7 @@ def retry_failed_workflows(self, sha: str) -> List[str]:
139139
# Check if workflow is retryable
140140
if self.retryable_workflows and run.name not in self.retryable_workflows:
141141
continue
142-
142+
143143
try:
144144
run.rerun()
145145
retried.append(run.name)

0 commit comments

Comments
 (0)