Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here the list of file changed or added in order to add the ability to use GitLab instead of GitHub as store repo. For each file, a simple description is given to describe its purpose within the application and the changes made for GitLab:
env.example
It's the file that contains the tokens for the repositories.
In addition to the original GITHUB_TOKEN variable, 2 new variables were added, GITLAB_TOKEN (used for the declarations-related repository) and GITLAB_RELEASES_TOKEN (used for the versions-related repository on which to save datasets in ZIP file format).
config/default.json
The file was modified by adding some new elements within the JSON structure of the file. In the "reminder" element, the same structure as "githubIssues" was added but named "gitlabIssues". In the "declaration" field the name of the repository should be given in the form "<owner_name>/<project_name>"
engine/src/index.js
The file is the module related to the declarations tracking procedure (performed with the "npx ota track" command).
It has been modified by adding checks for the presence of GitHub and GitLab tokens. In either case, the relevant Reporter (for GitHub) or ReporterGitLab (for GitLab) classes are instantiated.
engine/src/reporterGitlab/gitlab.js
This file contains the definition of the Gitlab class and all its related methods for operating on a repository: getRepositoryLabels, createLabel, createIssues, setIssueLabels, openIssue, closeIssue, getIssue, addCommentToIssue, closeIssueWithCommentIfExists, and createOrUpdateIssue. It contains some settings such as the url where to reach the API of the GitLab respo you want to use (for example: https://gitlab.com/api/v4 )
engine/src/reporterGitlab/index.js
This file contains the definition of the Reporter class related to the use of GitLab. Within it, the related methods of the GitLab class described above are invoked.
engine/src/reporterGitlab/labels.json
This file contains, via a JSON structure, the list of labels that must be present on the repository in order to properly create issues. In case no labels are present in the repository thanks to this file they are automatically created during the first run.
engine/src/reporterGitlab/labels.test.js
It's a Javascript file used to test the file "labels.json" to verify that all the info inserted complains with the GitLab constraints.
engine/scripts/dataset/index.js
The file is the module related to the creation of releases and datasets (performed with the "npx ota dataset" command). It has been modified by adding checks for the presence of GitHub and GitLab tokens.
In either case, the relevant publishRelease (for GitHub) or publishReleaseGitLab (for GitLab) classes are instantiated.
engine/scripts/dataset/assets/README.templateGitLab.js
This file contains the template with all the texts and links that are used into every releases created during the "dataset" process.
engine/scripts/dataset/publishGitLab/index.js
The file contains the function to publish a release on a GitLab repository. This function creates a release and the zip file that is attached as asset link to the release.