Skip to content

Discussion: updating the All Contributors App to the latest Probot #329

Closed

Description

@gr2m

Hi 👋🏼 I'm one of the @all-contributors maintainers. I also maintain @probot and @octokit, which the app is build upon. I haven't been very active in this year, but I'd like to help more moving forward.

My first objective is to upgrade the All Contributors app to the latest version of Probot and to minimize the maintenance overhead.

Here is my preliminary assessment and suggestions on what to do next

Where we are today

The code

The All Contributors consists of 3 repositories on GitHub

  1. https://github.com/all-contributors/all-contributors - source code of website, out of scope for this project
  2. https://github.com/all-contributors/all-contributors-cli - source code of the all-contributors CLI
  3. https://github.com/all-contributors/all-contributors-bot - source code of the @allcontributors app

The all-contributors repository is not used by the app. The app is using these exports by the CLI:

  • generate - takes the current file content (e.g. from README.md), array of contributors and an options object. Replaces the content between the <!-- ALL-CONTRIBUTORS-LIST: / --> tags with the new table of contributors
  • initBadge - update code for all-contributors badge (see this FAQ question).
    I don't understand:
    • why we need the HTML comments around the badge
    • why we need to update the badge at all, why isn't it dynamic in the first place?
  • initContributorsList - I think it initially adds a ## Contributors section to the README, used when installed initially
  • addContributorWithDetails - I think that this is used to update the .all-contributorsrc file?

The app code is using probot v8 and the serverless framework and aws-sdk. It's deployed to AWS using serverless. It's using @thundra/core, but I'm not aware of any public dashboards? I don't think I have access, and it's not mentioned in the privacy policy. It also sends tracking data to amplitude.com, which is also not mentioned in the privacy policy.

The biggest amount of logic lives in src/tasks/processIssueComment. The actual probot application function lives here. This is the core of the app. Everything else can probably be removed or greatly simplified. Several checks are done before invoking the probot app function that should be moved inside it.

My understanding is that the current implementation runs the lambda functions asynchronous to the http request. I don't think that's necessary, because in the most complex path the app creates one comment and a pull request updating two files. Execution time should not exceed 10s.

The maintenance

As far as I can tell we use the following services for CI, analytics and deployment

  • AWS
  • thundra.io
  • amplitude.com
  • Sentry (via Probot)
  • CircleCI
  • Codecov

For local development and CI, we also use a ton of dependencies

  • eslint
  • git-cz
  • serverless

Goal

The code

I think the all-contributors project should consist of 5 repositories:

  1. The website
  2. The specification: exports a JSON format. Should be super simple to reason about.
  3. A library which reads/writes configuration and updates markdown text. Has specification as dependency
  4. The CLI. Has library as dependency. Implements the CLI interface
  5. The App. Has library as dependency. Implements the GitHub App.

For the app, I think we should remove any trackers and use simple logging as a means to understand how the app is used. I would remove serverless and use Probot's new APIs that make it simple to use it in a function. I would suggest we deploy the app to Vercel. If we should need async event handling and/or data persistance, I'd suggest we deploy to Begin. Both have a GitHub integration that continuously deploys. Vercel also deploys previews for every pull request. We can register one or several GitHub apps for these preview environments if we want to test the app before deploying to production.

For logging I would use https://logflare.app/ which neatly integrates with Google's Data Studio without any overhead. It makes it trivial to create a public dashboard such as this one: wip.vercel.app/stats

For uptime status monitoring, I would use https://uptimerobot.com.

The maintenance

  • Replace CircleCI with GitHub Actions
  • Remove eslint, just use prettier
  • replace yarn with npm. npm is the common dominator, yarn folks know how to use npm, the other way around this is not necessary the case.
  • In general, remove as many dot files as possible. They all come with a price, mostly to new contributors and new maintainers who don't understand what they are.

There are lots of out-of-date stats in https://github.com/all-contributors/all-contributors/blob/master/MAINTAINERS.md. I would remove everything that cannot be automated. We can revisit the Roadmap/Goals and turn it into actionable items that are reasonable for a small maintenance team.

Next steps

I want to focus on the app first.

I'm not a fan of rewrites, but in this particular case I think it's the best strategy to move forward. I'll start a pull request where I'll throw away most of the code but will keep the tests for integrity, I'll setup deployment to Vercel and register a new GitHub App for testing while working on it.

I'll setup the Logflare and Sentry intgrations through Vercel's integrations. For CI/CD I'll setup GitHub Actions.

Activity

  1. Berkmann18 commented on Dec 25, 2020

    @Berkmann18
    Member

    why we need the HTML comments around the badge

    It was due to users raising issues linked to MarkdownLint (and co) complaining about the table.

    why we need to update the badge at all, why isn't it dynamic in the first place?

    That's a great point and someone posted a suggestion on all-contributors/allcontributors.org#406.

    The app code is using probot v8 and the serverless framework and aws-sdk. It's deployed to AWS using serverless. It's using @thundra/core, but I'm not aware of any public dashboards? I don't think I have access, and it's not mentioned in the privacy policy. It also sends tracking data to amplitude.com, which is also not mentioned in the privacy policy.

    There's no public dashboard AFAIK, @jakebolam?
    I didn't know about Aptitude, I'm not sure if @tbenning does.

    We can definitely improve the system, although I'm not fully sure to what extent.

    I think the app-contributors project should consist of 5 repositories:

    I would even go slightly further and have the following:
    AC_Container_Diagram

    I fully agree on the move from CircleCI to GH Action and using NPM over Yarn.

    ESLint compliments Prettier well so I think only choosing one when they serve slightly different purposes wouldn't a good idea.

    There are lots of out-of-date stats in https://github.com/all-contributors/all-contributors/blob/master/MAINTAINERS.md. I would remove everything that cannot be automated. We can revisit the Roadmap/Goals and turn it into actionable items that are reasonable for a small maintenance team.

    Yeah and the appraisals tha Jake used to do manually on all-contributors/allcontributors.org#143 should also be automated (that would require some way to use Crowdin's API if it exists).

  2. added
    discussion
    area: tooling
    priority: critical
    on Dec 25, 2020
  3. gr2m commented on Dec 26, 2020

    @gr2m
    ContributorAuthor

    I would even go slightly further and have the following

    This is a great diagram, we should add it to the project somehow! What have you used to create it? Is it an editable format we can collaborate on, in case we want to adjust it in future?

    The "reads" from the website to specification would not be dynamic. But every new release of the specification will trigger a rebuild of the website. I think "reads" is correct enough here

  4. Berkmann18 commented on Dec 27, 2020

    @Berkmann18
    Member

    This is a great diagram, we should add it to the project somehow! What have you used to create it? Is it an editable format we can collaborate on, in case we want to adjust it in future?

    I used C4-PlantUML which is an addon for PlantUML (a Diagram-as-Code tool like Graphviz/Dot and Structurizr) so the diagrams are easily editable and can be pushed to repos.

    I guess, having a separate repo for architectural matters would be a good way to store such diagrams (especially if we use several ones like https://c4model.com/#ComponentDiagram or others on https://plantuml.com).

    The "reads" from the website to specification would not be dynamic. But every new release of the specification will trigger a rebuild of the website. I think "reads" is correct enough here

    Yeah, I think it might be a bit similar to how content on Static-Site Generated sites gets updated when the content changes on (headless) CMSs.
    The "reads" would indeed only happen sparingly.

  5. github-actions commented on Jan 1, 2021

    @github-actions

    🎉 This issue has been resolved in version 1.10.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

  6. added
    released
    on Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: toolingdiscussionpriority: criticalreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions