Skip to content

Commit 130a334

Browse files
committed
Update
1 parent b941f6c commit 130a334

12 files changed

+149
-592
lines changed

CONTRIBUTING.md

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,53 @@
11
# Contribution Guidelines
22

3-
First and most importantly of all: Thank you for your interest in contributing to the Awesome Java list!
3+
First and most importantly: Thank you for your interest in contributing to the Awesome Java list!
44

55
## Automated Workflow
66

77
This repository uses an automated workflow to maintain the main `README.md` file. Here's how it works:
88

99
### For Contributors
1010

11-
1. **Edit `CONTRIBUTE_README.md`** - Make all your changes to this file, not `README.md`
12-
2. **Submit a Pull Request** - Create a PR with your changes to `CONTRIBUTE_README.md`
13-
3. **GitHub Actions will automatically**:
14-
- Convert the list format to HTML tables
15-
- Add GitHub stars and last commit badges
11+
1. Edit `CONTRIBUTE_README.md`: Make all your changes in this file, **not** `README.md`
12+
2. Submit a Pull Request: Create a PR with your changes to `CONTRIBUTE_README.md`
13+
3. GitHub Actions will automatically:
14+
- Convert the list format to markdown tables
15+
- Add GitHub stars and last commit dates
1616
- Update `README.md` with the converted content
1717
- Commit and push the changes
1818

1919
### What NOT to do
2020

21-
- **Don't edit `README.md` directly** - It will be overwritten by the automated workflow
22-
- **Don't edit the scripts** unless you're improving the conversion process
23-
- **Don't manually run the conversion scripts** - GitHub Actions handles this
21+
- Don't edit `README.md` directly, since it will be overwritten by the automated workflow
22+
- Don't edit the scripts, unless you're improving the conversion process
23+
- Don't manually run the conversion scripts, GitHub Actions handles this
2424

2525
## How to Contribute
2626

2727
### Adding a New Project
2828

29-
1. **Find the appropriate section** in `CONTRIBUTE_README.md`
30-
2. **Add your entry** using this format:
29+
1. Find the appropriate section in `CONTRIBUTE_README.md`
30+
2. Add your entry using this format:
31+
3132
```markdown
3233
- [Project Name](https://github.com/user/repo) - Brief description of what the project does.
3334
```
34-
3. **Follow the existing style**
35-
4. **Submit a Pull Request**
35+
36+
3. Follow the existing style
37+
4. Submit a Pull Request
3638

3739
### Updating an Existing Project
3840

39-
1. **Find the project** in `CONTRIBUTE_README.md`
40-
2. **Update the description** or URL as needed
41-
3. **Submit a Pull Request** with your changes
41+
1. Find the project in `CONTRIBUTE_README.md`
42+
2. Update the description or URL as needed
43+
3. Submit a Pull Request with your changes
4244

4345
### Adding a New Category
4446

45-
1. **Add the category** to the Contents section
46-
2. **Create a new section** with the appropriate heading
47-
3. **Add projects** to the new section
48-
4. **Submit a Pull Request** with your changes
47+
1. Add the category to the Contents section
48+
2. Create a new section with the appropriate heading
49+
3. Add projects to the new section
50+
4. Submit a Pull Request with your changes
4951

5052
## Guidelines
5153

@@ -75,31 +77,33 @@ This repository uses an automated workflow to maintain the main `README.md` file
7577

7678
The automated workflow (`update-readme.yml`) runs when:
7779

80+
- **Weekly schedule** - Every Monday at 00:00 UTC
7881
- **Push to master** - When `CONTRIBUTE_README.md` or scripts are updated
79-
- **Pull Request** - When `CONTRIBUTE_README.md` or scripts are modified
8082
- **Manual trigger** - Can be triggered manually from the Actions tab
8183

84+
The workflow requires a GitHub Personal Access Token (PAT) stored as `GITHUB_TOKEN` in repository secrets to fetch repository statistics.
85+
8286
### File Structure
8387

84-
```
85-
├── CONTRIBUTE_README.md # Source file (edit this)
86-
├── README.md # Generated file (don't edit)
88+
```text
89+
├── CONTRIBUTE_README.md # Source file (edit this)
90+
├── README.md # Generated file (don't edit)
8791
├── scripts/
8892
│ ├── run_workflow.java # Main workflow orchestrator
8993
│ ├── step_1_validate_input.java # Input validation
9094
│ ├── step_2_parse_projects.java # Project parsing
91-
│ ├── step_3_generate_badges.java # Badge generation
92-
│ ├── step_4_generate_tables.java # HTML table generation
95+
│ ├── step_3_generate_badges.java # Stats generation
96+
│ ├── step_4_generate_tables.java # Markdown table generation
9397
│ ├── step_5_assemble_readme.java # Final assembly
9498
│ ├── step_6_validate_transformation.java # Data integrity validation
9599
│ ├── ProjectEntry.java # Data model
96100
│ ├── FileUtils.java # Utility functions
97101
│ ├── Constants.java # Shared constants
98102
│ └── README.md # Script documentation
99-
├── .tmp/ # Temporary files (auto-generated)
103+
├── .tmp/ # Temporary files (auto-generated)
100104
│ ├── parsed-projects.txt
101-
│ ├── github-badges.txt
102-
│ └── generated-tables.html
105+
│ ├── github-stats.txt
106+
│ └── generated-tables.md
103107
└── .github/workflows/
104108
└── update-readme.yml # GitHub Actions workflow
105109
```
@@ -109,25 +113,30 @@ The automated workflow (`update-readme.yml`) runs when:
109113
The README generation follows a 6-step modular process:
110114

111115
1. **Step 1 - Input Validation** (`step_1_validate_input.java`)
116+
112117
- Validates that `CONTRIBUTE_README.md` exists and is readable
113118
- Provides file statistics
114119

115120
2. **Step 2 - Project Parsing** (`step_2_parse_projects.java`)
121+
116122
- Parses markdown content to extract project entries
117123
- Handles multi-line descriptions
118124
- Outputs: `parsed-projects.txt`
119125

120-
3. **Step 3 - Badge Generation** (`step_3_generate_badges.java`)
121-
- Generates GitHub badges for repositories
122-
- Creates stars and last-commit badges
123-
- Outputs: `github-badges.txt`
126+
3. **Step 3 - Stats Generation** (`step_3_generate_badges.java`)
127+
128+
- Fetches GitHub stars and last commit dates for repositories
129+
- Creates text values for stars and last commit dates
130+
- Outputs: `github-stats.txt`
124131

125132
4. **Step 4 - Table Generation** (`step_4_generate_tables.java`)
126-
- Combines parsed projects with badges
127-
- Generates HTML tables with proper styling
128-
- Outputs: `generated-tables.html`
133+
134+
- Combines parsed projects with stats
135+
- Generates markdown tables with proper styling
136+
- Outputs: `generated-tables.md`
129137

130138
5. **Step 5 - Final Assembly** (`step_5_assemble_readme.java`)
139+
131140
- Combines original content with generated tables
132141
- Produces the final `README.md`
133142

@@ -139,28 +148,33 @@ The README generation follows a 6-step modular process:
139148
### Running the Workflow
140149

141150
**Complete Workflow:**
151+
142152
```bash
143153
java --enable-preview --source 25 scripts/run_workflow.java
144154
```
145155

146156
**Individual Steps:**
157+
147158
```bash
148159
java --enable-preview --source 25 scripts/run_workflow.java [step_number]
149160
```
150161

151162
**Direct Step Execution:**
163+
152164
```bash
153165
java --enable-preview --source 25 scripts/step_1_validate_input.java
154166
java --enable-preview --source 25 scripts/step_2_parse_projects.java
155-
# ... etc
167+
# ...
156168
```
157169

158-
## 🐛 Troubleshooting
170+
**Note:** Step 3 requires the `GITHUB_TOKEN` environment variable to be set with a valid GitHub Personal Access Token.
171+
172+
## Troubleshooting
159173

160174
### Common Issues
161175

162176
1. **Workflow fails** - Check the Actions tab for error details
163-
2. **Badges not showing** - Ensure the repository URL is correct
177+
2. **Stats not showing** - Ensure the repository URL is correct and accessible
164178
3. **Formatting issues** - Check that your markdown is valid
165179
4. **Validation fails** - Step 6 validates data integrity:
166180
- Missing entries: Projects in original but not in final README
@@ -174,7 +188,7 @@ java --enable-preview --source 25 scripts/step_2_parse_projects.java
174188
- **Check existing issues** - Your question might already be answered
175189
- **Review the workflow logs** - In the Actions tab
176190

177-
## 📄 License
191+
## License
178192

179193
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
180194

LICENSE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# License
2+
13
[CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/legalcode)

scripts/Constants.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ private Constants() {}
1212
public static final String SUBSECTION = "### ";
1313
public static final String PROJECTS_SECTION = "## Projects";
1414

15-
// File patterns and markers
16-
public static final String ENTRY_PATTERN = "^\\s*-\\s*\\[.*";
15+
// Regex patterns
1716
public static final Pattern PROJECT_PATTERN = Pattern.compile("^\\s*-\\s*\\[([^\\]]+)\\]\\(([^)]+)\\)\\s*-\\s*(.+)");
17+
public static final Pattern GITHUB_REPO_PATTERN = Pattern.compile("https://github\\.com/([^)/\\s]+/[^)\\s#]+)");
18+
public static final Pattern MARKDOWN_LINK_PATTERN = Pattern.compile("\\[([^\\]]+)\\]\\(([^)]+)\\)");
19+
public static final Pattern STARS_PATTERN = Pattern.compile("\"stargazers_count\"\\s*:\\s*(\\d+)");
20+
public static final Pattern PUSHED_AT_PATTERN = Pattern.compile("\"pushed_at\"\\s*:\\s*\"([^\"]+)\"");
21+
public static final String ENTRY_PATTERN = "^\\s*-\\s*\\[.*";
1822
public static final String INDENTED_LINE_PATTERN = "^\\s+.*";
1923

2024
// File extensions and names

scripts/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static String readFileContent(Path inputPath) throws IOException {
4545
* Gets file statistics.
4646
*/
4747
public static String getFileStats(Path filePath) throws IOException {
48-
var lines = Files.readAllLines(filePath).size();
48+
var lines = Files.lines(filePath).count();
4949
var size = Files.size(filePath);
5050
return "Lines: %d, Size: %d bytes".formatted(lines, size);
5151
}

scripts/ProjectEntry.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import java.util.regex.Pattern;
2-
31
/**
42
* Represents a parsed project entry from the markdown file.
53
*/
@@ -24,8 +22,7 @@ public String getGitHubRepo() {
2422
if (!isGitHubRepo()) {
2523
return null;
2624
}
27-
var pattern = Pattern.compile("https://github\\.com/([^)/\\s]+/[^)\\s#]+)");
28-
var matcher = pattern.matcher(url);
25+
var matcher = Constants.GITHUB_REPO_PATTERN.matcher(url);
2926
return matcher.find() ? matcher.group(1) : null;
3027
}
3128
}

0 commit comments

Comments
 (0)