This project includes a model, an importer, and some visulization to evaluate the health of a GitLab or GitHub group.
Download a Moose image.
In the Moose image, in a playground (Ctrl+O
, Ctrl+W
), perform:
Metacello new
repository: 'github://moosetechnology/GitProjectHealth:main/src';
baseline: 'GitLabHealth';
onConflict: [ :ex | ex useIncoming ];
onUpgrade: [ :ex | ex useIncoming ];
onDowngrade: [ :ex | ex useLoaded ];
load
In a playground (Ctrl+O
, Ctrl+W
).
glhModel := GLHModel new.
glhApi := GLHApi new
privateToken: '<Your private token>';
baseAPIUrl:'https://gitlab.myPrivateHost.com/api/v4';
yourself.
glhImporter := GLHModelImporter new
glhApi: glhApi;
glhModel: glhModel.
"137 is the ID of the a Group, you can find the number in the webpage of every project and group"
glhImporter importGroup: 137.
In a playground (Ctrl+O
, Ctrl+W
).
glhModel := GLHModel new.
githubImporter := GHModelImporter new glhModel: glhModel; privateToken: '<my private token>'; yourself.
githubImporter importGroup: 'moosetechnology'.
GitLab API only
You might want to gather more commits for a specific repository. To do so in GitLab, we added the following API
myProject := ((glhModel allWithType: GLHProject) select: [ :project | project name = '<my projectName>' ]) anyOne.
glhImporter importCommitsOf: myProject withStats: true until: '2023-01-01' asDate.
To visualize the group "health"
dritGroup := (glhModel allWithType: GLHGroup) detect: [ :group | group id = 137 ].
canvas := (GLHGroupVisualization new forGroup: dritGroup).
canvas open.
To export the visualization as a svg image
dritGroup := (glhModel allWithType: GLHGroup) detect: [ :group | group id = 137 ].
canvas := (GLHGroupVisualization new forGroup: dritGroup).
canvas open.
canvas svgExporter
withoutFixedShapes;
fileName: 'drit-group-health';
export.
Here is the metamodel used in this project
This work has been first developed by the research department of Berger-Levrault