Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: ♻️ πŸ” πŸ”Š πŸ§‘β€πŸ’» Add Environment Variables and Convert Logging to Use Logwatch #119

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

slugb0t
Copy link
Member

@slugb0t slugb0t commented Dec 12, 2024

Summary by Sourcery

Refactor the logging system by replacing 'consola' with 'logwatch' for better log handling. Introduce new environment variables 'BOT_LOGWATCH_URL' and 'VALIDATOR_URL' to enhance configuration flexibility. Update CI workflows and deployment configurations to accommodate these changes.

Enhancements:

  • Convert logging from 'consola' to 'logwatch' for improved log management and consistency across the application.

Build:

  • Add new environment variables 'BOT_LOGWATCH_URL' and 'VALIDATOR_URL' to the deployment configuration.

CI:

  • Update CI workflows to include new environment variables 'BOT_LOGWATCH_URL' and 'VALIDATOR_URL'.

Copy link

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

Copy link

sourcery-ai bot commented Dec 12, 2024

Reviewer's Guide by Sourcery

This PR refactors the logging system by replacing direct console logging with a centralized logwatch utility and adds environment variables for configuration. The changes primarily focus on standardizing logging patterns and improving configuration management across the application.

Class diagram for Logwatch utility

classDiagram
    class Logwatch {
        +constructor(endpoint)
        +success(message, isJson=false)
        +warn(message, isJson=false)
        +info(message, isJson=false)
        +error(message, isJson=false)
        +_sendLog(level, message, format)
    }
    note for Logwatch "Centralized logging utility replacing consola"
Loading

File-Level Changes

Change Details Files
Replace console logging with logwatch utility
  • Replace consola.info/error/success calls with logwatch equivalents
  • Add structured logging support with JSON format option
  • Add success method to logwatch class
  • Standardize error logging format with additional context
bot/archival/index.js
bot/cwl/index.js
bot/index.js
bot/metadata/index.js
bot/license/index.js
bot/utils/tools/index.js
bot/utils/renderer/index.js
bot/utils/logwatch.js
Add environment variable configuration
  • Add BOT_LOGWATCH_URL environment variable
  • Add VALIDATOR_URL environment variable
  • Update deployment workflows with new environment variables
  • Update Kamal deployment configuration
bot/utils/logwatch.js
bot/config/deploy.yml
.github/workflows/deploy-main.yml
.github/workflows/deploy-staging.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @slugb0t - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟑 General issues: 2 issues found
  • 🟑 Security: 1 issue found
  • 🟒 Testing: all looks good
  • 🟒 Complexity: all looks good
  • 🟒 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

Comment on lines 51 to +54
}

const publishedDeposition = await publishDeposition.json();
consola.success("Zenodo deposition published successfully at:", publishedDeposition.links.latest_html);
logwatch.success(`Zenodo deposition published successfully at: ${publishedDeposition.links.latest_html}`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Add response status code check before parsing JSON response

Should verify publishDeposition.ok before attempting to parse JSON to avoid potential runtime errors with malformed responses.

Suggested change
}
const publishedDeposition = await publishDeposition.json();
consola.success("Zenodo deposition published successfully at:", publishedDeposition.links.latest_html);
logwatch.success(`Zenodo deposition published successfully at: ${publishedDeposition.links.latest_html}`);
const publishDeposition = await fetch(
`${ZENODO_API_ENDPOINT}/deposit/depositions/${depositionId}/actions/publish`,
{
}
if (!publishDeposition.ok) {
const errorText = await publishDeposition.text();
throw new Error(`Failed to publish Zenodo deposition. Status: ${publishDeposition.status}: ${publishDeposition.statusText}`, { cause: errorText });
}
const publishedDeposition = await publishDeposition.json();
logwatch.success(`Zenodo deposition published successfully at: ${publishedDeposition.links.latest_html}`);

@@ -7,7 +8,7 @@ class Logwatch {
*/
constructor(endpoint) {
const BOT_ENDPOINT =
"https://logwatch.fairdataihub.org/api/log/cm4hkn79200027r01ya9gij7r";
BOT_LOGWATCH_URL;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Add validation for BOT_LOGWATCH_URL environment variable

Should validate that BOT_LOGWATCH_URL is defined and is a valid URL at initialization time to prevent runtime errors.

Comment on lines 99 to +101
export async function validateCWLFile(downloadUrl) {
try {
const response = await fetch("https://cwl-validate.codefair.io/validate-cwl", {
const response = await fetch(`${VALIDATOR_URL}/validate-cwl`, {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Add URL validation for VALIDATOR_URL environment variable

Should validate VALIDATOR_URL is a properly formatted URL before using it in fetch calls.

Suggested change
export async function validateCWLFile(downloadUrl) {
try {
const response = await fetch("https://cwl-validate.codefair.io/validate-cwl", {
const response = await fetch(`${VALIDATOR_URL}/validate-cwl`, {
function isValidUrl(string) {
try {
new URL(string);
return true;
} catch (_) {
return false;
}
}
export async function validateCWLFile(downloadUrl) {
try {
if (!VALIDATOR_URL || !isValidUrl(VALIDATOR_URL)) {
logwatch.error({message: "Invalid VALIDATOR_URL environment variable"}, true);
return [false, "Configuration error: Invalid validator URL"];
}
const response = await fetch(`${VALIDATOR_URL}/validate-cwl`, {

@slugb0t slugb0t merged commit f10eae4 into staging Dec 12, 2024
Copy link

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!

slugb0t added a commit that referenced this pull request Dec 12, 2024
… Use Logwatch (#120)

* refactor: ♻️ transfer validation api to codefair repo (#106)

* 🚚 chore: rename `validator-api` to `validator`

* πŸ‘· ci: add validator deploy

* πŸ‘· ci: add validator healthcheck

* πŸ‘· ci: add validator deploy for prod

* refactor: ♻️ update codefair name

* feat: ✨ Metadata + license validators + bug patches (#107)

* merge: πŸ”€ merge main to staging

* refactor: ♻️ πŸ› Codefair 3.1.0 (#89)

* fix: πŸ› patch removing pull_request.closed bug on metadata pr merge

* fix: πŸ› don't update firstPublished in the codemeta file + better logs

* fix: πŸ› patch error on reading db entry when it doesn't exist

* chore: πŸ”Š better log on successful Zenodo publish

* style: 🎨 margins between text and icon

* feat: ✨ links to the list of tools used for codefair in /codefair

* refactor: ✨ ♻️ abstract the license validation fn

* doc: πŸ”– update changelog

* feat: ✨ ♻️ abstraction to zenodo workflow

* wip: 🚧 abstracting zenodo workflow

* feat: ✨ add help link in the Zenodo release page

* refactor: ♻️ ✨ abstract out github release functions

* refactor: πŸ”Š ♻️ improve error tracing in metadata file

* chore: πŸ”¨ remove todo

* refactor: ✨ ♻️ abstracted Zenodo workflow (bot)

* wip: 🚧 save custom license content when no assertion is provided

* ✨ feat: add support for custom licenses (#90)

* ✨ feat: add support for custom licenses

* πŸ› fix: reset citation license field

* πŸ› fix: update zenodo workflow for custom licenses

* fix: πŸ› license is valid with custom license

* feat: ✨ custom license template

* ✨ feat: update codemeta, license and cwl ui paths (#91)

* ✨ feat: update meta paths for consistency

* 🚚 fix: updatel icense request path

* ✨ feat: add support for custom license title (#92)

* refactor: ♻️ ✨ new patches for license, cwl, metadata UI's

* refactor: ✨ ♻️ apply migrations from UI to bot

* feat: ✨ request custom license title from user

* refactor: ♻️ hide message box when custom license title is blank

* refactor: ♻️ issue dashboard requests custom title

* feat: ✨ Saving custom title (#93)

* feat: ✨ save custom title option

* refactor: :recyle: reuse saveLicenseDraft for storing custom license title

* refactor: ♻️ join draft and save title buttons together

* refactor: ♻️ use naive-ui's properties for styling

* chore: πŸ”¨ remove typo

* chore: πŸ”¨ remove unused variables

* feat: ✨ toasts for custom title saved button

* refactor: ♻️ function rename

* feat: ✨ create Zenodo metadata fn handles custom licenses

* feat: ✨ custom license reference for archival workflow

* refactor: ♻️ stop creating identifiers for new db entries

* refactor: ♻️ πŸ› revert allowing custom licenses for zenodo

* refactor: ♻️ Custom License Support (#94)

* refactor: ♻️ ✨ custom title saved updates dashboard, disable create release btn when custom license

* refactor: ♻️ block progress of fair release if license is custom

* feat: ✨ listener for when custom license title is saved through UI

* feat: ✨ prevent fair release if not fair compliant

* refactor: ♻️ improve license validation and update template text for custom licenses

* refactor: ♻️ re-render issue from ui side

* refactor: ♻️ update to message explaining custom licenses

* db calls running in parallel

* fix: πŸ› prevent Zendo section from being seen when the license is custom

* fix: πŸ› trim license content before comparison

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* refactor: ♻️ safety checks for protected middleware

* refacotr: ♻️ update protectRoute to redirect to login when no user or session

* feat: :fix: redirect to login if not signed in

* refactor: ♻️ remove import

* chore: πŸ”Š πŸ”¨ remove logs

* docs: πŸ“ update changelog

* fix: πŸ› check license content all times

* fix: πŸ› update on zenodo ui page

* feat: ✨ delete branch after pr has been closed/merged

* chore: πŸ”¨ spacing in changelog

* wip: 🚧 individual validation requests for license and metadata

* feat: ✨ license validation endpoint

* wip: 🚧 creating updated metadata validation

* wip: 🚧 patches for metadata revalidation workflow

* wip: 🚧 validation for codemeta

* doc: πŸ”– jsdoc comments on fns

* fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› rerender template will stop using old links

* doc: πŸ“ update CHANGELOG

* doc: πŸ“ update metadata

* fix: πŸ› preserve authors and contributors from codemeta

* feat: ✨ re-validated codemeta from repo dashboard

* fix: πŸ› await metadata validation

* feat: ✨ codemeta validation extended with microservice validator

* refactor: ♻️ update timestamps to be unix format

* feat: ✨ clean privatekey env before use

* refactor: ♻️ update cwl validation endpoint

* wip: 🚧 send validation message to db

* feat: ✨ create migrations for metadata validation messages

* wip: 🚧 creating json schema for codemeta.json validations

* πŸ‘· ci: setup deployment environments (#101)

* πŸ‘· ci: setup for staging env (#103)

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>
Co-authored-by: slugb0t <wheresdorian@gmail.com>
fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› adjust env variables used after env changes

* πŸ‘· ci: cleanup dockerfile

* feat: ✨ codemeta schema first draft

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: fix staging deploys (#104)

* wip: 🚧 abstracting cwl workflow

* refactor: ♻️ update codemeta schema to validate against the raw codemeta.json files

* refactor: ♻️ update codemeta schema for additional fields

* feat: ✨ validating raw content of codemeta.json file for 3.0

* refactor: ♻️ create required fields for codemeta schema

* wip: 🚧 testing validation responses for db

* handle codemeta.json 3.0 and 2.0 versioning

* fix: πŸ› correct branch watch for staging deployment action

* doc: πŸ”– update changelog for 3.2.0 release

* feat: ✨ align bot prisma with ui

* fix: πŸ› bug patch for cwl workflow

* feat: ✨ metadata workflow update

* refactor: ♻️ preserving authors and contributors

* wip: 🚧 update the metadata workflow after discussions

* fix: πŸ› don't create cwlobject twice

* refactor: ♻️ send 200 status when invalid codemeta

* refactor: ♻️ update codemeta validation schema

* refactor: ♻️ do not revalidate metadata files for push events unless metadata files are updated themselves

* wip: 🚧 seperate rerun validation with regather information

* wip: 🚧 remove command from issue dashboard if error occurs (allows retry)

* refactor: ♻️ update the issue body after successful validation (remove the command from the issue body)

* refactor: ♻️ add additional key to codemeta schema

* refactor: ♻️ remove the regather options from the UI as validation is still needed when regathering

* fix: πŸ› pr button updated with new links

* fix: πŸ› patch variable declaration not in scope

* refactor: ♻️ update on the dropdown icons

* refactor: ♻️ update the keys of the cwl object

* refactor: ♻️ update the getcwlfiles function

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* fix: πŸ› use the correct env variable for private key

* fix: πŸ› Codefair v3.2.0 finalization (#113)

* fix: πŸ› correct cwlObject variables in push event

* fix: πŸ› better error message in metadata workflow + collect missing fields from codemeta.json

* fix: πŸ› apply await to async function call

* refactor: ♻️ removed unused imports

* refactor: ♻️ add try catch in then statement of promise

* fix: πŸ› missing fields in codemeta gathering + add error handling for convertCitationForDB fn

* refactor: ♻️ add try catch to renderer to preserve errors

* fix: πŸ› preserve metadata validation results in db

* wip: 🚧 validation results being displayed through the repo dashboard

* wip: 🚧 displaying metadata validation results in seperate pages

* feat: ✨ validation page for codemeta

* fix: πŸ› patch fundingCode not being preserved from codemeta

* wip: 🚧 final design for validation results

* feat: ✨ add view validation results conditionally

* test: βš—οΈ ensuring validation progresses accordingly

* feat: ✨ popover messages for metadata badges

* feat: ✨ if metadata file fails to parse then update validation message

* fix: πŸ› update schema to handle 2.0 and 3.0 authors

* style: 🎨 formatting

* fix: πŸ› add releaseNotes key to schema for 3.0 versions

* refactor: ✏️ change wording

* fix: πŸ› validate metadata file that was updated only on push events

* chore: πŸ“ remove test logs

* fix: πŸ› migrate db during deployment

* fix: πŸ› revert

* fix: πŸ› typo on dockerfile

* refactor: ♻️ use npm instead of yarn for migration

* refactor: ♻️ access db url during prisma build

* refactor: ♻️ apply node env

* πŸ’š ci: copy package json

* πŸ’š ci: revert arg

* πŸ’š ci: add prisma migrate to ci

* πŸ’š ci: add prisma migrate to ci

* πŸ‘· ci: update dockerfile

* refactor: ♻️ use deployed validator

* fix: πŸ› when license is updated validate metadata files

* fix: πŸ› validation returns codemeta version on errors

* πŸ› fix: add basic logwatch

* fix: πŸ› add @type key for 2.0 codemeta.json files

* refactor: ♻️ updated required fields for codemeta schmea

* πŸ› fix: add logwatch support

* πŸ› fix: add json to logwatch

* fix: πŸ› patch json parse issue

* fix: πŸ› update logging parameters

* refactor: ♻️ point a folder above for codemeta-schema

* refactor: ♻️ update dockerfile to include schema

* fix: πŸ› ensure authors have roles key

* refactor: ♻️ πŸ”Š convert some consola logs to logwatch

* fix: πŸ› roles are optional in save request

* chore: πŸ”Š remove dev logs

* doc: πŸ“ update changelog

* refactor: ♻️ revert roles key being optional

* fix: πŸ› add logwatch.start method

* fix: πŸ› ensure contrib and authros have roles

* fix: πŸ› CWL handles multiple installations

* refactor: ♻️ update log error

* feat: ✨ purge zenodo token when sign in is required

* fix: πŸ› make login fn asyncronous

* refactor: 🎨 update spacing and color of validation results button

* fix: πŸ› bad logwatch call removed

* chore: πŸ”¨ sync main to staging (#118)

* fix: πŸ› Zenodo callback issue resolved with purging token before sign in (#116)

* refactor: ♻️ transfer validation api to codefair repo (#106)

* 🚚 chore: rename `validator-api` to `validator`

* πŸ‘· ci: add validator deploy

* πŸ‘· ci: add validator healthcheck

* πŸ‘· ci: add validator deploy for prod

* refactor: ♻️ update codefair name

* feat: ✨ Metadata + license validators + bug patches (#107)

* merge: πŸ”€ merge main to staging

* refactor: ♻️ πŸ› Codefair 3.1.0 (#89)

* fix: πŸ› patch removing pull_request.closed bug on metadata pr merge

* fix: πŸ› don't update firstPublished in the codemeta file + better logs

* fix: πŸ› patch error on reading db entry when it doesn't exist

* chore: πŸ”Š better log on successful Zenodo publish

* style: 🎨 margins between text and icon

* feat: ✨ links to the list of tools used for codefair in /codefair

* refactor: ✨ ♻️ abstract the license validation fn

* doc: πŸ”– update changelog

* feat: ✨ ♻️ abstraction to zenodo workflow

* wip: 🚧 abstracting zenodo workflow

* feat: ✨ add help link in the Zenodo release page

* refactor: ♻️ ✨ abstract out github release functions

* refactor: πŸ”Š ♻️ improve error tracing in metadata file

* chore: πŸ”¨ remove todo

* refactor: ✨ ♻️ abstracted Zenodo workflow (bot)

* wip: 🚧 save custom license content when no assertion is provided

* ✨ feat: add support for custom licenses (#90)

* ✨ feat: add support for custom licenses

* πŸ› fix: reset citation license field

* πŸ› fix: update zenodo workflow for custom licenses

* fix: πŸ› license is valid with custom license

* feat: ✨ custom license template

* ✨ feat: update codemeta, license and cwl ui paths (#91)

* ✨ feat: update meta paths for consistency

* 🚚 fix: updatel icense request path

* ✨ feat: add support for custom license title (#92)

* refactor: ♻️ ✨ new patches for license, cwl, metadata UI's

* refactor: ✨ ♻️ apply migrations from UI to bot

* feat: ✨ request custom license title from user

* refactor: ♻️ hide message box when custom license title is blank

* refactor: ♻️ issue dashboard requests custom title

* feat: ✨ Saving custom title (#93)

* feat: ✨ save custom title option

* refactor: :recyle: reuse saveLicenseDraft for storing custom license title

* refactor: ♻️ join draft and save title buttons together

* refactor: ♻️ use naive-ui's properties for styling

* chore: πŸ”¨ remove typo

* chore: πŸ”¨ remove unused variables

* feat: ✨ toasts for custom title saved button

* refactor: ♻️ function rename

* feat: ✨ create Zenodo metadata fn handles custom licenses

* feat: ✨ custom license reference for archival workflow

* refactor: ♻️ stop creating identifiers for new db entries

* refactor: ♻️ πŸ› revert allowing custom licenses for zenodo

* refactor: ♻️ Custom License Support (#94)

* refactor: ♻️ ✨ custom title saved updates dashboard, disable create release btn when custom license

* refactor: ♻️ block progress of fair release if license is custom

* feat: ✨ listener for when custom license title is saved through UI

* feat: ✨ prevent fair release if not fair compliant

* refactor: ♻️ improve license validation and update template text for custom licenses

* refactor: ♻️ re-render issue from ui side

* refactor: ♻️ update to message explaining custom licenses

* db calls running in parallel

* fix: πŸ› prevent Zendo section from being seen when the license is custom

* fix: πŸ› trim license content before comparison

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* refactor: ♻️ safety checks for protected middleware

* refacotr: ♻️ update protectRoute to redirect to login when no user or session

* feat: :fix: redirect to login if not signed in

* refactor: ♻️ remove import

* chore: πŸ”Š πŸ”¨ remove logs

* docs: πŸ“ update changelog

* fix: πŸ› check license content all times

* fix: πŸ› update on zenodo ui page

* feat: ✨ delete branch after pr has been closed/merged

* chore: πŸ”¨ spacing in changelog

* wip: 🚧 individual validation requests for license and metadata

* feat: ✨ license validation endpoint

* wip: 🚧 creating updated metadata validation

* wip: 🚧 patches for metadata revalidation workflow

* wip: 🚧 validation for codemeta

* doc: πŸ”– jsdoc comments on fns

* fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› rerender template will stop using old links

* doc: πŸ“ update CHANGELOG

* doc: πŸ“ update metadata

* fix: πŸ› preserve authors and contributors from codemeta

* feat: ✨ re-validated codemeta from repo dashboard

* fix: πŸ› await metadata validation

* feat: ✨ codemeta validation extended with microservice validator

* refactor: ♻️ update timestamps to be unix format

* feat: ✨ clean privatekey env before use

* refactor: ♻️ update cwl validation endpoint

* wip: 🚧 send validation message to db

* feat: ✨ create migrations for metadata validation messages

* wip: 🚧 creating json schema for codemeta.json validations

* πŸ‘· ci: setup deployment environments (#101)

* πŸ‘· ci: setup for staging env (#103)

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>
Co-authored-by: slugb0t <wheresdorian@gmail.com>
fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› adjust env variables used after env changes

* πŸ‘· ci: cleanup dockerfile

* feat: ✨ codemeta schema first draft

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: fix staging deploys (#104)

* wip: 🚧 abstracting cwl workflow

* refactor: ♻️ update codemeta schema to validate against the raw codemeta.json files

* refactor: ♻️ update codemeta schema for additional fields

* feat: ✨ validating raw content of codemeta.json file for 3.0

* refactor: ♻️ create required fields for codemeta schema

* wip: 🚧 testing validation responses for db

* handle codemeta.json 3.0 and 2.0 versioning

* fix: πŸ› correct branch watch for staging deployment action

* doc: πŸ”– update changelog for 3.2.0 release

* feat: ✨ align bot prisma with ui

* fix: πŸ› bug patch for cwl workflow

* feat: ✨ metadata workflow update

* refactor: ♻️ preserving authors and contributors

* wip: 🚧 update the metadata workflow after discussions

* fix: πŸ› don't create cwlobject twice

* refactor: ♻️ send 200 status when invalid codemeta

* refactor: ♻️ update codemeta validation schema

* refactor: ♻️ do not revalidate metadata files for push events unless metadata files are updated themselves

* wip: 🚧 seperate rerun validation with regather information

* wip: 🚧 remove command from issue dashboard if error occurs (allows retry)

* refactor: ♻️ update the issue body after successful validation (remove the command from the issue body)

* refactor: ♻️ add additional key to codemeta schema

* refactor: ♻️ remove the regather options from the UI as validation is still needed when regathering

* fix: πŸ› pr button updated with new links

* fix: πŸ› patch variable declaration not in scope

* refactor: ♻️ update on the dropdown icons

* refactor: ♻️ update the keys of the cwl object

* refactor: ♻️ update the getcwlfiles function

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* fix: πŸ› use the correct env variable for private key

* fix: πŸ› Codefair v3.2.0 finalization (#113)

* fix: πŸ› correct cwlObject variables in push event

* fix: πŸ› better error message in metadata workflow + collect missing fields from codemeta.json

* fix: πŸ› apply await to async function call

* refactor: ♻️ removed unused imports

* refactor: ♻️ add try catch in then statement of promise

* fix: πŸ› missing fields in codemeta gathering + add error handling for convertCitationForDB fn

* refactor: ♻️ add try catch to renderer to preserve errors

* fix: πŸ› preserve metadata validation results in db

* wip: 🚧 validation results being displayed through the repo dashboard

* wip: 🚧 displaying metadata validation results in seperate pages

* feat: ✨ validation page for codemeta

* fix: πŸ› patch fundingCode not being preserved from codemeta

* wip: 🚧 final design for validation results

* feat: ✨ add view validation results conditionally

* test: βš—οΈ ensuring validation progresses accordingly

* feat: ✨ popover messages for metadata badges

* feat: ✨ if metadata file fails to parse then update validation message

* fix: πŸ› update schema to handle 2.0 and 3.0 authors

* style: 🎨 formatting

* fix: πŸ› add releaseNotes key to schema for 3.0 versions

* refactor: ✏️ change wording

* fix: πŸ› validate metadata file that was updated only on push events

* chore: πŸ“ remove test logs

* fix: πŸ› migrate db during deployment

* fix: πŸ› revert

* fix: πŸ› typo on dockerfile

* refactor: ♻️ use npm instead of yarn for migration

* refactor: ♻️ access db url during prisma build

* refactor: ♻️ apply node env

* πŸ’š ci: copy package json

* πŸ’š ci: revert arg

* πŸ’š ci: add prisma migrate to ci

* πŸ’š ci: add prisma migrate to ci

* πŸ‘· ci: update dockerfile

* refactor: ♻️ use deployed validator

* fix: πŸ› when license is updated validate metadata files

* fix: πŸ› validation returns codemeta version on errors

* πŸ› fix: add basic logwatch

* fix: πŸ› add @type key for 2.0 codemeta.json files

* refactor: ♻️ updated required fields for codemeta schmea

* πŸ› fix: add logwatch support

* πŸ› fix: add json to logwatch

* fix: πŸ› patch json parse issue

* fix: πŸ› update logging parameters

* refactor: ♻️ point a folder above for codemeta-schema

* refactor: ♻️ update dockerfile to include schema

* fix: πŸ› ensure authors have roles key

* refactor: ♻️ πŸ”Š convert some consola logs to logwatch

* fix: πŸ› roles are optional in save request

* chore: πŸ”Š remove dev logs

* doc: πŸ“ update changelog

* refactor: ♻️ revert roles key being optional

* fix: πŸ› add logwatch.start method

* fix: πŸ› ensure contrib and authros have roles

* fix: πŸ› CWL handles multiple installations

* refactor: ♻️ update log error

* feat: ✨ purge zenodo token when sign in is required

* fix: πŸ› make login fn asyncronous

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* refactor: 🎨 update view validation & edit metadata buttons (#117)

* refactor: ♻️ transfer validation api to codefair repo (#106)

* 🚚 chore: rename `validator-api` to `validator`

* πŸ‘· ci: add validator deploy

* πŸ‘· ci: add validator healthcheck

* πŸ‘· ci: add validator deploy for prod

* refactor: ♻️ update codefair name

* feat: ✨ Metadata + license validators + bug patches (#107)

* merge: πŸ”€ merge main to staging

* refactor: ♻️ πŸ› Codefair 3.1.0 (#89)

* fix: πŸ› patch removing pull_request.closed bug on metadata pr merge

* fix: πŸ› don't update firstPublished in the codemeta file + better logs

* fix: πŸ› patch error on reading db entry when it doesn't exist

* chore: πŸ”Š better log on successful Zenodo publish

* style: 🎨 margins between text and icon

* feat: ✨ links to the list of tools used for codefair in /codefair

* refactor: ✨ ♻️ abstract the license validation fn

* doc: πŸ”– update changelog

* feat: ✨ ♻️ abstraction to zenodo workflow

* wip: 🚧 abstracting zenodo workflow

* feat: ✨ add help link in the Zenodo release page

* refactor: ♻️ ✨ abstract out github release functions

* refactor: πŸ”Š ♻️ improve error tracing in metadata file

* chore: πŸ”¨ remove todo

* refactor: ✨ ♻️ abstracted Zenodo workflow (bot)

* wip: 🚧 save custom license content when no assertion is provided

* ✨ feat: add support for custom licenses (#90)

* ✨ feat: add support for custom licenses

* πŸ› fix: reset citation license field

* πŸ› fix: update zenodo workflow for custom licenses

* fix: πŸ› license is valid with custom license

* feat: ✨ custom license template

* ✨ feat: update codemeta, license and cwl ui paths (#91)

* ✨ feat: update meta paths for consistency

* 🚚 fix: updatel icense request path

* ✨ feat: add support for custom license title (#92)

* refactor: ♻️ ✨ new patches for license, cwl, metadata UI's

* refactor: ✨ ♻️ apply migrations from UI to bot

* feat: ✨ request custom license title from user

* refactor: ♻️ hide message box when custom license title is blank

* refactor: ♻️ issue dashboard requests custom title

* feat: ✨ Saving custom title (#93)

* feat: ✨ save custom title option

* refactor: :recyle: reuse saveLicenseDraft for storing custom license title

* refactor: ♻️ join draft and save title buttons together

* refactor: ♻️ use naive-ui's properties for styling

* chore: πŸ”¨ remove typo

* chore: πŸ”¨ remove unused variables

* feat: ✨ toasts for custom title saved button

* refactor: ♻️ function rename

* feat: ✨ create Zenodo metadata fn handles custom licenses

* feat: ✨ custom license reference for archival workflow

* refactor: ♻️ stop creating identifiers for new db entries

* refactor: ♻️ πŸ› revert allowing custom licenses for zenodo

* refactor: ♻️ Custom License Support (#94)

* refactor: ♻️ ✨ custom title saved updates dashboard, disable create release btn when custom license

* refactor: ♻️ block progress of fair release if license is custom

* feat: ✨ listener for when custom license title is saved through UI

* feat: ✨ prevent fair release if not fair compliant

* refactor: ♻️ improve license validation and update template text for custom licenses

* refactor: ♻️ re-render issue from ui side

* refactor: ♻️ update to message explaining custom licenses

* db calls running in parallel

* fix: πŸ› prevent Zendo section from being seen when the license is custom

* fix: πŸ› trim license content before comparison

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* refactor: ♻️ safety checks for protected middleware

* refacotr: ♻️ update protectRoute to redirect to login when no user or session

* feat: :fix: redirect to login if not signed in

* refactor: ♻️ remove import

* chore: πŸ”Š πŸ”¨ remove logs

* docs: πŸ“ update changelog

* fix: πŸ› check license content all times

* fix: πŸ› update on zenodo ui page

* feat: ✨ delete branch after pr has been closed/merged

* chore: πŸ”¨ spacing in changelog

* wip: 🚧 individual validation requests for license and metadata

* feat: ✨ license validation endpoint

* wip: 🚧 creating updated metadata validation

* wip: 🚧 patches for metadata revalidation workflow

* wip: 🚧 validation for codemeta

* doc: πŸ”– jsdoc comments on fns

* fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› rerender template will stop using old links

* doc: πŸ“ update CHANGELOG

* doc: πŸ“ update metadata

* fix: πŸ› preserve authors and contributors from codemeta

* feat: ✨ re-validated codemeta from repo dashboard

* fix: πŸ› await metadata validation

* feat: ✨ codemeta validation extended with microservice validator

* refactor: ♻️ update timestamps to be unix format

* feat: ✨ clean privatekey env before use

* refactor: ♻️ update cwl validation endpoint

* wip: 🚧 send validation message to db

* feat: ✨ create migrations for metadata validation messages

* wip: 🚧 creating json schema for codemeta.json validations

* πŸ‘· ci: setup deployment environments (#101)

* πŸ‘· ci: setup for staging env (#103)

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>
Co-authored-by: slugb0t <wheresdorian@gmail.com>
fix: πŸ› template renderer will stop using old links (#99)

* fix: πŸ› adjust env variables used after env changes

* πŸ‘· ci: cleanup dockerfile

* feat: ✨ codemeta schema first draft

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: setup for staging env

* πŸ‘· ci: cleanup dockerfile

* πŸ‘· ci: fix staging deploys (#104)

* wip: 🚧 abstracting cwl workflow

* refactor: ♻️ update codemeta schema to validate against the raw codemeta.json files

* refactor: ♻️ update codemeta schema for additional fields

* feat: ✨ validating raw content of codemeta.json file for 3.0

* refactor: ♻️ create required fields for codemeta schema

* wip: 🚧 testing validation responses for db

* handle codemeta.json 3.0 and 2.0 versioning

* fix: πŸ› correct branch watch for staging deployment action

* doc: πŸ”– update changelog for 3.2.0 release

* feat: ✨ align bot prisma with ui

* fix: πŸ› bug patch for cwl workflow

* feat: ✨ metadata workflow update

* refactor: ♻️ preserving authors and contributors

* wip: 🚧 update the metadata workflow after discussions

* fix: πŸ› don't create cwlobject twice

* refactor: ♻️ send 200 status when invalid codemeta

* refactor: ♻️ update codemeta validation schema

* refactor: ♻️ do not revalidate metadata files for push events unless metadata files are updated themselves

* wip: 🚧 seperate rerun validation with regather information

* wip: 🚧 remove command from issue dashboard if error occurs (allows retry)

* refactor: ♻️ update the issue body after successful validation (remove the command from the issue body)

* refactor: ♻️ add additional key to codemeta schema

* refactor: ♻️ remove the regather options from the UI as validation is still needed when regathering

* fix: πŸ› pr button updated with new links

* fix: πŸ› patch variable declaration not in scope

* refactor: ♻️ update on the dropdown icons

* refactor: ♻️ update the keys of the cwl object

* refactor: ♻️ update the getcwlfiles function

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* fix: πŸ› use the correct env variable for private key

* fix: πŸ› Codefair v3.2.0 finalization (#113)

* fix: πŸ› correct cwlObject variables in push event

* fix: πŸ› better error message in metadata workflow + collect missing fields from codemeta.json

* fix: πŸ› apply await to async function call

* refactor: ♻️ removed unused imports

* refactor: ♻️ add try catch in then statement of promise

* fix: πŸ› missing fields in codemeta gathering + add error handling for convertCitationForDB fn

* refactor: ♻️ add try catch to renderer to preserve errors

* fix: πŸ› preserve metadata validation results in db

* wip: 🚧 validation results being displayed through the repo dashboard

* wip: 🚧 displaying metadata validation results in seperate pages

* feat: ✨ validation page for codemeta

* fix: πŸ› patch fundingCode not being preserved from codemeta

* wip: 🚧 final design for validation results

* feat: ✨ add view validation results conditionally

* test: βš—οΈ ensuring validation progresses accordingly

* feat: ✨ popover messages for metadata badges

* feat: ✨ if metadata file fails to parse then update validation message

* fix: πŸ› update schema to handle 2.0 and 3.0 authors

* style: 🎨 formatting

* fix: πŸ› add releaseNotes key to schema for 3.0 versions

* refactor: ✏️ change wording

* fix: πŸ› validate metadata file that was updated only on push events

* chore: πŸ“ remove test logs

* fix: πŸ› migrate db during deployment

* fix: πŸ› revert

* fix: πŸ› typo on dockerfile

* refactor: ♻️ use npm instead of yarn for migration

* refactor: ♻️ access db url during prisma build

* refactor: ♻️ apply node env

* πŸ’š ci: copy package json

* πŸ’š ci: revert arg

* πŸ’š ci: add prisma migrate to ci

* πŸ’š ci: add prisma migrate to ci

* πŸ‘· ci: update dockerfile

* refactor: ♻️ use deployed validator

* fix: πŸ› when license is updated validate metadata files

* fix: πŸ› validation returns codemeta version on errors

* πŸ› fix: add basic logwatch

* fix: πŸ› add @type key for 2.0 codemeta.json files

* refactor: ♻️ updated required fields for codemeta schmea

* πŸ› fix: add logwatch support

* πŸ› fix: add json to logwatch

* fix: πŸ› patch json parse issue

* fix: πŸ› update logging parameters

* refactor: ♻️ point a folder above for codemeta-schema

* refactor: ♻️ update dockerfile to include schema

* fix: πŸ› ensure authors have roles key

* refactor: ♻️ πŸ”Š convert some consola logs to logwatch

* fix: πŸ› roles are optional in save request

* chore: πŸ”Š remove dev logs

* doc: πŸ“ update changelog

* refactor: ♻️ revert roles key being optional

* fix: πŸ› add logwatch.start method

* fix: πŸ› ensure contrib and authros have roles

* fix: πŸ› CWL handles multiple installations

* refactor: ♻️ update log error

* feat: ✨ purge zenodo token when sign in is required

* fix: πŸ› make login fn asyncronous

* refactor: 🎨 update spacing and color of validation results button

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>

* chore: πŸ“ Update CITATION.cff with Zenodo identifier

* chore: πŸ“ Update codemeta.json with Zenodo identifier

* fix: πŸ› bad logwatch calls removed

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>
Co-authored-by: codefair-io[bot] <165336008+codefair-io[bot]@users.noreply.github.com>

* refactor: ♻️ πŸ” πŸ”Š πŸ§‘β€πŸ’» Add Environment Variables and Convert Logging to Use Logwatch (#119)

* dev: πŸ§‘β€πŸ’» πŸ” add env variables for logwatch and validator

* refactor: ♻️ πŸ”Š replace consola with logwatch

* doc: πŸ“ update CHANGELOG

---------

Co-authored-by: Sanjay Soundarajan <sanjay.16@live.com>
Co-authored-by: codefair-io[bot] <165336008+codefair-io[bot]@users.noreply.github.com>
@megasanjay megasanjay deleted the config-update branch December 14, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant