Skip to content

Commit 63f5949

Browse files
committed
Auto commit experiment
PR-URL: #136
1 parent a64d455 commit 63f5949

File tree

12 files changed

+138
-85
lines changed

12 files changed

+138
-85
lines changed

.editorconfig

-12
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/src/Templates/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Software engineering self assessment
2+
3+
$BADGE
4+
5+
## Skills
6+
7+
- [Programming fundamentals](Skills/Programming.md)
8+
- [JavaScript](Skills/JavaScript.md)
9+
- [Asynchronous programming](Skills/Async.md)
10+
- [Node.js and Backend](Skills/NodeJS.md)
11+
- [Multi-paradigm programming](Skills/Paradigms.md)
12+
13+
## How to use
14+
15+
- Fork repository
16+
- Create branch, for example: `2023-autumn` or `2024-winter`
17+
- In new branch add following levels or leave line untouched in each file as of :
18+
- 👂 heard, 🎓 known, 🖐️ used, 🙋 explained, 📢 talked, 🔬 researched, 🚀 constructed
19+
- Now you can create pull request and merge this to main branch of your fork (prefer single commit: use squash and merge)
20+
- Repeat self assessment after course or training
21+
- Now You can compare branches with URL:
22+
- `https://github.com/<YOUR-ACCOUNT>/SelfAssessment/compare/2023-autumn...2024-winter`
23+
24+
## Example
25+
26+
It should look like following example after filling it out:
27+
28+
```
29+
- Syntax and concepts
30+
- value: 🙋 explained
31+
- identifier: 🖐️ used
32+
- variable: 🙋 explained
33+
- constant: 🖐️ used
34+
- scalar: 🖐️ used
35+
- literal: 👂 heard
36+
- expression: 🖐️ used
37+
- heap: 🎓 known
38+
```

package-lock.json .github/src/package-lock.json

+14-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json .github/src/package.json

+2-19
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,17 @@
44
"author": "Timur Shemsedinov <[email protected]>",
55
"license": "MIT",
66
"description": "Software engineering self assessment",
7-
"keywords": [
8-
"node.js",
9-
"javascript",
10-
"software",
11-
"programming",
12-
"software engineering",
13-
"self assessment"
14-
],
157
"readmeFilename": "README.md",
168
"engines": {
179
"node": ">=18.0.0"
1810
},
19-
"repository": {
20-
"type": "git",
21-
"url": "git+https://github.com/HowProgrammingWorks/SelfAssessment.git"
22-
},
23-
"bugs": {
24-
"url": "https://github.com/HowProgrammingWorks/SelfAssessment/issues",
25-
"email": "[email protected]"
26-
},
27-
"homepage": "https://github.com/HowProgrammingWorks/Index",
2811
"scripts": {
29-
"test": "node ./src/skills.js",
3012
"lint": "eslint . && prettier -c \"**/*.js\" \"**/*.json\"",
3113
"fmt": "prettier --write \"**/*.js\" \"**/*.json\""
3214
},
3315
"dependencies": {
34-
"concolor": "^1.1.0"
16+
"concolor": "^1.1.0",
17+
"metautil": "^5.2.0"
3518
},
3619
"devDependencies": {
3720
"eslint": "^8.56.0",

.github/src/skills.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
'use strict';
2+
3+
const fs = require('node:fs').promises;
4+
const path = require('node:path');
5+
const cp = require('node:child_process');
6+
const metautil = require('metautil');
7+
const concolor = require('concolor');
8+
9+
const TITLE = 'Software engineering self assessment';
10+
const PARSING_TIMEOUT = 1000;
11+
const EXECUTION_TIMEOUT = 5000;
12+
13+
const PATH = path.join(process.cwd(), '../..');
14+
15+
const OUT = cp.execSync('git config --get remote.origin.url').toString();
16+
const REPO = metautil.between(OUT, ':', '.');
17+
const LINK = 'https://github.com/' + REPO;
18+
19+
const BASE = 'https://img.shields.io/badge/Self_Assessment-skills-009933';
20+
const STYLE = `style=flat-square`;
21+
const BADGE = `[![Skills](${BASE}?${STYLE})](${LINK})`;
22+
23+
const codeBlock = (code) => '```\n' + code + '\n```';
24+
25+
const loadFile = async (file) => {
26+
const fileName = path.join(PATH, file);
27+
const data = await fs.readFile(fileName, 'utf8');
28+
return data;
29+
};
30+
31+
const countLines = (s) => {
32+
let count = 1;
33+
for (let i = 0; i < s.length; i++) {
34+
if (s[i] === '\n') count++;
35+
}
36+
return count;
37+
};
38+
39+
const analise = async (section) => {
40+
const md = await loadFile(`Skills/${section}.md`);
41+
const lines = countLines(md);
42+
console.log(concolor.info(`Lines: ${lines}`));
43+
return ;
44+
};
45+
46+
(async () => {
47+
console.log(concolor.white(TITLE));
48+
console.log(concolor.info('Auto Checker'));
49+
50+
const files = await fs.readdir(`${PATH}/Skills/`);
51+
const sections = files
52+
.filter((file) => file.endsWith('.md'))
53+
.map((file) => file.substring(0, file.length - '.md'.length));
54+
for (const section of sections) {
55+
console.log(concolor`\nCheck: ${section}(b,white)`);
56+
await analise(section);
57+
}
58+
59+
const badgeCode = codeBlock(BADGE);
60+
61+
const report = `## ${TITLE}\n\n${BADGE}\n\n${badgeCode}\n`;
62+
await fs.writeFile(`${PATH}/Profile/REPORT.md`, report);
63+
64+
const readme = await loadFile('.github/src/Templates/README.md');
65+
const newReadme = readme.replace('$BADGE', BADGE);
66+
await fs.writeFile(`${PATH}/README.md`, newReadme);
67+
68+
console.log('');
69+
process.exit(0);
70+
})();

.github/workflows/test.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
name: Check slills
1+
name: Check skills
22
on: pull_request
33
jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v4
8+
with:
9+
ref: ${{ github.event.pull_request.head.ref }}
810
- name: Node.js
911
uses: actions/setup-node@v4
1012
with:
@@ -16,4 +18,13 @@ jobs:
1618
restore-keys: |
1719
${{ runner.os }}-node-
1820
- run: npm ci
19-
- run: npm t
21+
working-directory: .github/src
22+
- run: node skills.js
23+
working-directory: .github/src
24+
- name: Generate results
25+
run: |
26+
git config --global user.name "Metarhia skill bot"
27+
git config --global user.email "[email protected]"
28+
git add ./Profile ./README.md
29+
git commit -m "Automated skill analysis"
30+
git push

Profile/REPORT.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Software engineering self assessment

src/skills.js

-47
This file was deleted.

0 commit comments

Comments
 (0)