Skip to content

Commit 2300d5e

Browse files
committed
gc-init
1 parent dfab00c commit 2300d5e

11 files changed

Lines changed: 840 additions & 3 deletions
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## 🐛 Bug Description
10+
11+
A clear and concise description of what the bug is.
12+
13+
## 📋 Steps to Reproduce
14+
15+
1. Go to '...'
16+
2. Run command '...'
17+
3. See error
18+
19+
## ✅ Expected Behavior
20+
21+
A clear and concise description of what you expected to happen.
22+
23+
## ❌ Actual Behavior
24+
25+
What actually happened instead.
26+
27+
## 🖥️ Environment
28+
29+
- **OS**: [e.g., Ubuntu 22.04, macOS 14.0]
30+
- **Shell**: [e.g., bash 5.1, zsh 5.9]
31+
- **Version**: [e.g., v1.0.0, commit abc123]
32+
33+
## 📸 Screenshots / Logs
34+
35+
If applicable, add screenshots or terminal output to help explain your problem.
36+
37+
```
38+
Paste relevant logs here
39+
```
40+
41+
## 📝 Additional Context
42+
43+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: 💬 Discussions
4+
url: https://github.com/xaoscience/NG-S4/discussions
5+
about: Ask questions and discuss ideas
6+
- name: 📖 Documentation
7+
url: https://github.com/xaoscience/NG-S4#readme
8+
about: Read the documentation
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## 🚀 Feature Description
10+
11+
A clear and concise description of the feature you'd like.
12+
13+
## 💡 Problem / Motivation
14+
15+
What problem does this solve? Why is this feature needed?
16+
17+
## 📋 Proposed Solution
18+
19+
Describe the solution you'd like to see implemented.
20+
21+
## 🔄 Alternatives Considered
22+
23+
A clear and concise description of any alternative solutions or features you've considered.
24+
25+
## 📝 Additional Context
26+
27+
Add any other context, mockups, or examples about the feature request here.
28+
29+
## ✅ Acceptance Criteria
30+
31+
- [ ] Criteria 1
32+
- [ ] Criteria 2
33+
- [ ] Criteria 3

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## 📋 Description
2+
3+
Brief description of the changes in this PR.
4+
5+
## 🔗 Related Issue
6+
7+
Fixes #(issue number)
8+
9+
## 🔄 Type of Change
10+
11+
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
12+
- [ ] ✨ New feature (non-breaking change which adds functionality)
13+
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] 📚 Documentation update
15+
- [ ] 🔧 Refactoring (no functional changes)
16+
- [ ] 🧪 Tests (adding or updating tests)
17+
18+
## ✅ Checklist
19+
20+
- [ ] My code follows the project's style guidelines
21+
- [ ] I have performed a self-review of my code
22+
- [ ] I have commented my code, particularly in hard-to-understand areas
23+
- [ ] I have made corresponding changes to the documentation
24+
- [ ] My changes generate no new warnings
25+
- [ ] I have tested my changes locally
26+
27+
## 🧪 How Has This Been Tested?
28+
29+
Describe the tests you ran to verify your changes.
30+
31+
```bash
32+
# Example test commands
33+
```
34+
35+
## 📸 Screenshots (if applicable)
36+
37+
Add screenshots to help explain your changes.
38+
39+
## 📝 Additional Notes
40+
41+
Any additional information that reviewers should know.
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Bash Linting with Auto-Fix Suggestions
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- develop
9+
paths:
10+
- '**.sh'
11+
- '.github/workflows/bash-lint-advanced.yml'
12+
pull_request:
13+
branches:
14+
- main
15+
- master
16+
- develop
17+
paths:
18+
- '**.sh'
19+
workflow_dispatch:
20+
inputs:
21+
auto_fix:
22+
description: 'Attempt automatic fixes for common issues'
23+
required: false
24+
default: 'false'
25+
26+
jobs:
27+
shellcheck-analysis:
28+
name: ShellCheck Analysis & Suggestions
29+
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
pull-requests: write
33+
checks: write
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Install tools
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y shellcheck
45+
46+
- name: Run ShellCheck with JSON output
47+
id: shellcheck
48+
continue-on-error: true
49+
run: |
50+
mkdir -p /tmp/lint
51+
52+
# Run ShellCheck for all scripts
53+
find . -type f -name "*.sh" ! -path "./.git/*" ! -path "./node_modules/*" ! -path "./vendor/*" \
54+
-exec shellcheck -f json {} + > /tmp/lint/results.json 2>&1 || true
55+
56+
# Count issues
57+
ERRORS=$(jq '[.[] | select(.level=="error")] | length' /tmp/lint/results.json 2>/dev/null || echo "0")
58+
WARNINGS=$(jq '[.[] | select(.level=="warning")] | length' /tmp/lint/results.json 2>/dev/null || echo "0")
59+
60+
echo "errors=$ERRORS" >> $GITHUB_OUTPUT
61+
echo "warnings=$WARNINGS" >> $GITHUB_OUTPUT
62+
63+
cat /tmp/lint/results.json
64+
65+
- name: Parse and annotate issues
66+
if: always()
67+
run: |
68+
if [[ ! -f /tmp/lint/results.json ]]; then
69+
echo "No linting results found"
70+
exit 0
71+
fi
72+
73+
jq -r '.[] | "::notice file=\(.file),line=\(.line),col=\(.column)::[\(.code)] \(.message) - See: https://www.shellcheck.net/wiki/\(.code)"' /tmp/lint/results.json 2>/dev/null || true
74+
75+
- name: Generate suggestions markdown
76+
id: suggestions
77+
run: |
78+
{
79+
echo "# 🔍 Bash Linting Report"
80+
echo ""
81+
echo "**Errors**: ${{ steps.shellcheck.outputs.errors }}"
82+
echo "**Warnings**: ${{ steps.shellcheck.outputs.warnings }}"
83+
echo ""
84+
85+
if [[ -f /tmp/lint/results.json ]]; then
86+
echo "## Issues Found:"
87+
echo ""
88+
89+
jq -r '.[] |
90+
"### [\(.code)] \(.message)\n" +
91+
"- **File**: `\(.file)` (line \(.line), col \(.column))\n" +
92+
"- **Severity**: \(.level)\n" +
93+
"- **Wiki**: https://www.shellcheck.net/wiki/\(.code)\n"' /tmp/lint/results.json 2>/dev/null || echo "No issues parsed"
94+
fi
95+
} > /tmp/lint/suggestions.md
96+
97+
cat /tmp/lint/suggestions.md
98+
99+
- name: Suggest fixes on PR
100+
if: github.event_name == 'pull_request' && (steps.shellcheck.outputs.errors > 0 || steps.shellcheck.outputs.warnings > 0)
101+
uses: actions/github-script@v8
102+
with:
103+
script: |
104+
const fs = require('fs');
105+
const results = JSON.parse(fs.readFileSync('/tmp/lint/results.json', 'utf8'));
106+
107+
if (results.length === 0) return;
108+
109+
// Group issues by file
110+
const issuesByFile = {};
111+
results.forEach(issue => {
112+
if (!issuesByFile[issue.file]) {
113+
issuesByFile[issue.file] = [];
114+
}
115+
issuesByFile[issue.file].push(issue);
116+
});
117+
118+
// Create review with suggestions
119+
const reviewComments = [];
120+
Object.entries(issuesByFile).forEach(([file, issues]) => {
121+
issues.forEach(issue => {
122+
reviewComments.push({
123+
path: file,
124+
line: issue.line,
125+
side: 'RIGHT',
126+
body: `**[SC${issue.code}]** ${issue.message}\n\n[📖 Read more](https://www.shellcheck.net/wiki/${issue.code})`
127+
});
128+
});
129+
});
130+
131+
if (reviewComments.length > 0) {
132+
github.rest.pulls.createReview({
133+
owner: context.repo.owner,
134+
repo: context.repo.repo,
135+
pull_number: context.issue.number,
136+
event: 'COMMENT',
137+
comments: reviewComments.slice(0, 50) // GitHub limit: 50 comments per review
138+
}).catch(err => {
139+
console.log('Note: Could not create inline review (file may not be in diff)');
140+
console.log(err.message);
141+
});
142+
}
143+
144+
summary:
145+
name: Linting Summary
146+
runs-on: ubuntu-latest
147+
needs: [shellcheck-analysis]
148+
if: always()
149+
150+
steps:
151+
- name: Create summary
152+
run: |
153+
echo "## 📊 Bash Linting Summary" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
echo "**Errors**: ${{ needs.shellcheck-analysis.outputs.errors }}" >> $GITHUB_STEP_SUMMARY
156+
echo "**Warnings**: ${{ needs.shellcheck-analysis.outputs.warnings }}" >> $GITHUB_STEP_SUMMARY
157+
echo "" >> $GITHUB_STEP_SUMMARY
158+
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
159+
echo "1. Review issues in workflow annotations" >> $GITHUB_STEP_SUMMARY
160+
echo "2. Check PR comments for detailed suggestions" >> $GITHUB_STEP_SUMMARY
161+
echo "3. Follow linked wiki pages for explanations" >> $GITHUB_STEP_SUMMARY
162+
echo "4. Create PR with fixes" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)