Skip to content

Commit

Permalink
feat: ✨ Codefair v2 (#61)
Browse files Browse the repository at this point in the history
* feat: ✨ improvement to bot workflow

* fix: 🐛 correct codemeta url

* fix: 🐛 correct collection call with correct name

* style: 🎨 prettier refactor

* refactor: ♻️ update on call for installation and analytics collection

* ✨ feat: add front end support for cwl validation (#41)

* ✨ feat: add support for cwl validation

* 🚧 wip: rework ui for validation_message

* ✨ feat: add support for rerunning validations

* 🐛 fix: update server error mesage key

* 🐛 fix: sanity check for dashboard issue

* 🐛 fix: update description text

* feat: ✨ CWL validations across repo, single instance db, bot restructering, updated CWL github issue template (#42)

* feat: ✨ support for .cwl file checks (#39)

* refactor: ♻️ update on ui and issue dashboard text (#40)

* feat: ✨ support for .cwl file checks

* refactor: update ui text and dashboard message

* feat: ✨ recursive search for all cwl files in repo

* wip: 🚧 handle multiple cwl validations

* feat: ✨ validate multiple cwl files across repo

* feat: ✨ validate cwl files with deployed server

* refactor: ♻️ apply collapsible table for cwl validation report

* feat: ✨ db singleton + issue number added to installation table

* chore: 🔨 code cleanup

* feat: ✨ remove db as parameters throughout codefair bot

* fix: 🐛 patch verify repo name function

* docs: 📝 add JSDoc comments on new functions

* refactor: ♻️ key value for issue number change

* feat: ✨ rerun cwl validations from frontend, on uninstall delete repo from all collections

* feat: ✨ handles for when issue is closed and reopened

* refactor: ♻️ exit push event in the case of no entry in installation collection

* feat: ✨ bot event listeners concised + extra cwl validation checks (#43)

* wip: optmizing bot code

* feat: ✨ combined event listeners for bot + cwl template on no cwl files

* 🐛 fix: rework dashboard page for clarity (#44)

* 🚧 wip: update dashboard ui

* 🚧 wip: update dashboard ui

* 💄 style: add breadcrumbs to pages

* 🐛 fix: rework license ui on dashboard

* ✏️ fix: update license body text

* 🐛 fix: vhange view to edit on dashboard buttons

* feat: ✨ action queue limit + cwl template updates (#45)

* wip: 🚧 create queue for large org installs

* fix: 🐛 cwl private repo template only if cwls exist

* fix: 🐛 gather proper file metadata and iterate through payload for push event

* fix: 🐛 correct valid/total count in cwl template

* bug: :fix: action count increase only if less than 4

* fix: 🐛 add await to db call

* fix: 🐛 overwriting previous cwl files in db patched

* feat: ✨ set action key to false upon reaching action count limit

* feat: ✨ full run through on action limit, display previous validations on issue dashboard

* dev: 📝 better comments

* feat: ✨ better comments and always show total validations on issue dashboard

* ✨ feat: Add support for DB migrations (#46)

* 🚧 wip: add support for mongodb migrations

* 🐛 fix: add support for github org membership verification

* 💄 style: update alert ui

* 🔊 chore: add console logs for migration steps

* ⏪ revert: only run one update for the migration

* ✨ feat: add a simple faq for errors (#47)

* fix: 🐛 bot patches for cwl and action queue features (#48)

* feat: ✨ remove deleted cwl files from db

* dev: 📝 better comments

* fix: 🐛 add await to db search, set to false if gatherd cwl is undefind

* refactor: ♻️ convert getcwlFiles fn to a promise

* refactor: ♻️ remove token from url string in priv repos, update emojis on validation report

* refator: ♻️ sourcery notes

* refactor: ♻️ sourcery notes (push fn out function block

* refactor: ♻️ const declaration on validateCWLFile function call

* feat: ✨ consola for logging (#49)

* 🐛 fix: check github org permissions (#50)

* 🐛 fix: check github org permissions

* 🔒️ fix: remove public config variable

* 🔇 chore: remove logs

* 🧑‍💻 chore: remove old dashboard

* refactors: ♻️ action limit update (#51)

* wip: 🚧 action queue handling

* refactor: ♻️ remove close issue feat when app is uninstalled

* 📈 feat: add metrics for ui side (#52)

* feat: ✨ analytics validatedFileCount (#53)

* fix: 🐛 if file is deleted, check for overall status before final return of template

* chore: 🔨 todo removed

* refactor: ♻️ update issue dashboard template for CWL section (#54)

* refactor: :refactor: additional cwl logs and action queue decreases

* chore: 🔨 removed unnecessary logs

* ➖ chore: remove consola from ui

* 🔊 chore: log error

* 🔥 Feat: removing old cwl UI

old cwl UI from hackathon removed

* fix: 🐛 update cwl db when file is modified

* fix: 🐛 failedcount/cwlfilecount ratio for issue template

* fix: 🐛 cwl bug patches (#55)

* wip: 🚧 🐛 patched count on modifying cwl file

* refactor: ♻️ update applycwltemplate fn to make it easier to read

* refactor: ♻️ update on cwl workflow, improved handling and validation

* wip: 🚧 bug catching cwl workflow

* feat: ✨ final touches for cwl workflow

* feat: ✨ boolean db field for fair items existence check

* refactor: ♻️ apply<fairItem>template moved to fair item file

* refactor: ♻️ align contains_license key with other collections

* feat: ✨ validation status + trigger bot rerun full validation (#56)

* feat: ✨ license_status key added to db

* refactor: ♻️ better variable name and removed unused fns

* logs: 🔊 better logging on bot side

* feat: ✨ last updated info applied to issue dashboard + rerun full repo validation command listener added

* refactor: ♻️ improved workflow for license template renderer

* feat: ✨ validate metadata files formatting

* feat: ✨ include validation check for when only one metadata file exists

* refactor: 📝 update readme run githb app locally section

* Update README.md

* refactor: ♻️ update /fairsoftware page text

* feat: ✨ Add button to direct to docs on codefair homepage

* refactor: ♻️ /fairsoftware learn more about codefair directs to /codefair

* refactor: ♻️ remove mention of fair-biors guidelines from bot

* refactor: ♻️ remove mention of fair biors guidelines in UI

* ✨ feat: bring ui dashboard to issue dashboard level (#57)

* ✨ feat: add title to cwl on dashboard

* 🚧 wip: dashboard repo layout

* 🚧 wip: dashboard repo layout

* 🚧 wip: nav state

* ✨ feat: Add breadcrumbs

* ✨ feat: add repo settings page

* ✨ feat: add repo revalidation

* feat: ✨ apply latest github info through bot

* refactor: ♻️ Load commit info based on installation collection

* fix: 🐛 view codefair settings link determine by isOrganization key

* refactor: ♻️ update bot function for clarification

* fix: 🐛 remove files that were deleted on rerun triggered from

* fix: 🐛 typo fix

* feat: ✨ links added to homepage

* ✨ feat: add sashboard badges

* 🐛 fix: downgrade nuxtlinks

---------

Co-authored-by: slugb0t <[email protected]>

* 🐛 fix: undefined vars

* fix: 🐛 get default branch name for commit info

* fix: 🐛 patch iterating through existing cwl files for removal

* refactor: ♻️ Prettier refactors

* refactor: ♻️ display repos with no action limit in UI dashboard

* refactor: 🏗️ update bot file structure (#59)

* refactor: 🎨 standardize spacing of content for dashboard cards

* refactor: ♻️ update on styling of repo cards

* 🔀 merge: main to staging branch (#60)

* fix: 🐛 metadata url update + collection call correct

* fix: 🐛 typo fix and exit workflow on push event if installation does not exist

* feat: ✨ add codemeta file

* feat: ✨ add citation file

* Create CHANGELOG.md

* Update README.md

* Update README.md

---------

Co-authored-by: codefair-app[bot] <165336008+codefair-app[bot]@users.noreply.github.com>
Co-authored-by: Bhavesh Patel <[email protected]>

* fix: 🐛 correct typo in README

* feat: 🔖 bump version number to v2.0.0

* feat: ✨ activate dashboard

* refactor: ♻️ remove mention of the fair-biors guidelines in bot

* feat: ✨ if issue is reopened update the latest commits in db

* feat: ✨ fetch commit details if bot yet has not done so

* revert: ⏪ remove fetching commits from UI

* Update CITATION.cff

* Update codemeta.json

* Update README.md

* Update CHANGELOG.md

* update: 📝 update CHANGELOG for v2

* refactor: ♻️ PR feedback resolved

* refactor: ♻️ update validator endpoint

---------

Co-authored-by: Sanjay Soundarajan <[email protected]>
Co-authored-by: codefair-app[bot] <165336008+codefair-app[bot]@users.noreply.github.com>
Co-authored-by: Bhavesh Patel <[email protected]>
  • Loading branch information
4 people authored Aug 29, 2024
1 parent 795a4ab commit 3ac9ee4
Show file tree
Hide file tree
Showing 57 changed files with 4,078 additions and 6,617 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,35 @@ All notable changes the Codefair App will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## v.2.0.0 - 2024-08-29

### Identifier

https://doi.org/10.5281/zenodo.13544387

### Added

- Full CWL Validation to entire repositories and an user interface to view the validation reports.
- UI Dashboard has been added for beta testing. The dashboard will provide a central location of the repositories being managed by Codefair. Users will have the ability to update their FAIR compliance items along with rerunning CWL validations and/or enture FAIR compliance checks.
- Single instance database was created for the bot to remove the need for the database to be passed as a parameter in most of the bot functions.
- An action queue was created for users who install Codefair to a large number of repositories in one installation. This will prevent an organization/user account from being spammed with alerts on issues being opened for each repository. The action queue will require 5 actions on said repository before the bot will begin to open a Fair Compliance Dashboard issue.

### Changed

- Workflow on the bot has been optimzed to reduce the number of database calls and improving the overall performance/readability of the bot.
- File restructuring was done on the bot to improve maintainability and readability.
- Logging has been updated on the bot side to use Consola for better tracking of bot errors and runtime details.

### Removed

- Mention of the FAIR-BioRS Guidelines have been removed to prevent users from thinking Codefair is solely for biomedical research software.

## v1.0.0 - 2024-08-26

### Identifier

https://doi.org/10.5281/zenodo.13376617

### Added

- First release with license file and metadata files generating features
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ message: If you use this software, please cite it using the metadata from this f
type: software
identifiers:
- type: doi
value: https://doi.org/10.5281/zenodo.13376617
value: https://doi.org/10.5281/zenodo.13544387
abstract: "Codefair is a free and open source GitHub app that acts as your
personal assistant when it comes to making your research software reusable and
especially complying with the Findable, Accessible, Interoperable, Reusable
Expand All @@ -33,5 +33,5 @@ keywords:
- software
license: MIT
repository-code: https://github.com/fairdataihub/codefair-app
version: 1.0.0
date-released: 2024-08-26
version: 2.0.0
date-released: 2024-08-29
48 changes: 8 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Your coding assistant to make research software reusable without breaking a swea
<a href="https://github.com/fairdataihub/codefair-app/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/fairdataihub/codefair-app.svg?style=flat-square" alt="license" />
</a>
<a href="https://doi.org/10.5281/zenodo.13376617">
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.13376617.svg" alt="Zenodo DOI" />
<a href="https://doi.org/10.5281/zenodo.13376616">
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.13376616.svg" alt="Zenodo DOI" />
</a>
<a href="https://archive.softwareheritage.org/browse/origin/https://github.com/fairdataihub/codefair-app/">
<img src="https://archive.softwareheritage.org/badge/origin/https://github.com/fairdataihub/codefair-app/" alt="Software Heritage archive" />
Expand Down Expand Up @@ -65,46 +65,17 @@ Codefair is your personal assistant when it comes to making your research softwa
> While Codefair is free, installing it via the GitHub Marketplace may still require a credit card to be associated with your (or your organization’s) GitHub account. To circumvent this requirement, you can alternatively install Codefair directly from the [app page](https://github.com/apps/codefair-app).
### Documentation
See the our [dedicated webpage](https://docs.codefair.io) for the full documentation, including details about each features and how to use them.

## Run the GitHub app locally

### Setup

This repository uses a pnpm workspace to handle both the bot and the frontend UI. You will need to install pnpm globally to run the app locally. You will also need to be on Node.js version 20 or higher.

```bash
npm install -g pnpm
```

To start both the bot and the frontend UI, run the following command at the root of the repository:

```bash
pnpm dev
```
See our [dedicated webpage](https://docs.codefair.io/docs/installation.html) for full details on what permissions are used and the features Codefair provides.

This will start the bot and the frontend UI in development mode. The bot will be available at `http://localhost:3001` and the frontend UI will be available at `http://localhost:3000`.

The .env files for each package are located in the respective package directories. You will need to create a `.env` file in the `bot` and `ui` directories. Use the .env.example files in each directory as a template.

To run the bot only, run the following command at the root of the repository:

```bash
cd bot
pnpm dev
```

To run the frontend UI only, run the following command at the root of the repository:
## Run the GitHub app locally

```bash
cd ui
pnpm dev
```
For detailed instructions on setting up running the application locally, please refer to our [documentation site](https://docs.codefair.io/dev/running-locally.html).

## How Codefair is developed

Codefair is developed using Probot and is deployed on a server as a serverless function. The GitHub app is configured to receive webhooks for important actions such as pushing code, opening or closing issues, opening or merging pull requests and commenting on discussions.
By leveraging a serverless environment on a server, Codefair can automatically scale to handle the workload of the GitHub app. The app is written in Node.js and utilizes the Octokit library to interact with the GitHub APIenabling seamless integration with GitHub's features and functionality.
Codefair is developed using [Probot](https://probot.github.io/docs/) and is deployed on a server as a serverless function. The GitHub app is configured to receive webhooks for important actions such as pushing code, opening or closing issues, opening or merging pull requests and commenting on discussions.
By leveraging a serverless environment on a server, Codefair can automatically scale to handle the workload of the GitHub app. The app is written in [Node.js](https://nodejs.org/en) and utilizes the [Octokit library](https://github.com/octokit) to interact with the GitHub API enabling seamless integration with GitHub's features and functionality.

## Contributing

Expand All @@ -127,11 +98,8 @@ This work is licensed under

## How to cite

If you are using this package or reusing the source code from this repository for any purpose, please cite:
If you are using this package or reusing the source code from this repository for any purpose, please cite the corresponding Zenodo record. If you are using the latest version, you can see the citation instruction in the GitHub Citation panel or in the CITATION.cff file. You can also find the citation instruction on the Zenodo page 10.5281/zenodo.13376616 (especially if you would like to cite an older version).

```text
Portillo, D., Soundarajan, S., & Patel, B., (2024). Codefair App. Zenodo. 10.5281/zenodo.13376617
```
<br />

---
Expand Down
1 change: 1 addition & 0 deletions bot/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-manager-strict=false
5 changes: 1 addition & 4 deletions bot/utils/citation/index.js → bot/citation/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gatherRepoAuthors } from "../tools/index.js";
import { gatherRepoAuthors } from "../utils/tools/index.js";

export async function checkForCitation(context, owner, repo) {
try {
Expand All @@ -14,7 +14,6 @@ export async function checkForCitation(context, owner, repo) {
}
}


// TODO: Verify if this is still needed
export async function gatherCitationInfo(context, owner, repo) {
// Verify there is no PR open already for the CITATION.cff file
Expand Down Expand Up @@ -86,9 +85,7 @@ export async function gatherCitationInfo(context, owner, repo) {
// Get the keywords of the repo
let keywords = [];
if (repoData.data.topics != null && repoData.data.topics.length > 0) {
// console.log(repoData.data.topics);
keywords = repoData.data.topics;
// console.log(keywords);
}

// Begin creating json for CITATION.cff file
Expand Down
4 changes: 1 addition & 3 deletions bot/utils/codemeta/index.js → bot/codemeta/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gatherRepoAuthors } from "../tools/index.js";
import { gatherRepoAuthors } from "../utils/tools/index.js";

export async function checkForCodeMeta(context, owner, repo) {
try {
Expand All @@ -23,8 +23,6 @@ export async function gatherCodeMetaInfo(context, owner, repo) {
});

// Get the languages used in the repo
console.log(repoData.data);

const languagesUsed = await gatherLanguagesUsed(context, owner, repo);
const authors = await gatherRepoAuthors(context, owner, repo, "codemeta");
const codeRepository = repoData.data.html_url;
Expand Down
Loading

0 comments on commit 3ac9ee4

Please sign in to comment.