Skip to content

Load issues dynamically in the Issue Finder #543

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

Merged
merged 9 commits into from
Nov 29, 2020
Merged

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Oct 12, 2020

Fixes

Fixes #542 by @dhruvkb
Fixes #523 by @dhruvkb

Description

This PR uses the Octokit Search API which is not authenticated to find and display issues.

Technical details

This removes the need for the hourly pull and push in ccos-scripts and will also reduce the bot commits to the repo.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb requested review from a team as code owners October 12, 2020 10:59
@dhruvkb dhruvkb requested review from akmadian, kgodey and zackkrida and removed request for a team October 12, 2020 10:59
Copy link
Member Author

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

As a side-effect, this fixes the issue of wrong colours being applied to the skill labels.

@@ -178,6 +178,20 @@ export const App = {
const BASE_URL = 'https://raw.githubusercontent.com/creativecommons/ccos-scripts/master/normalize_repos'
const FILE_URL = name => `${BASE_URL}/${name}.json`

const octokit = new Octokit();
octokit.search.issuesAndPullRequests({
q: 'org:creativecommons is:open is:issue label:"help wanted"',
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we remove the issues awaiting triage?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a separate filter for issues awaiting triage.

const octokit = new Octokit();
octokit.search.issuesAndPullRequests({
q: 'org:creativecommons is:open is:issue label:"help wanted"',
per_page: 100
Copy link
Member Author

Choose a reason for hiding this comment

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

I've observed this number to be ~60 so we can skip pagination for now.

Copy link
Member

@kgodey kgodey left a comment

Choose a reason for hiding this comment

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

@dhruvkb the code for this looks fine, but I'm concerned about making this dependent on JavaScript. One of the advantages of having a static site is that it doesn't depend on JavaScript, if we're just using JavaScript for filtering, it can gracefully degrade.

@@ -178,6 +178,20 @@ export const App = {
const BASE_URL = 'https://raw.githubusercontent.com/creativecommons/ccos-scripts/master/normalize_repos'
const FILE_URL = name => `${BASE_URL}/${name}.json`

const octokit = new Octokit();
octokit.search.issuesAndPullRequests({
q: 'org:creativecommons is:open is:issue label:"help wanted"',
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a separate filter for issues awaiting triage.

@dhruvkb
Copy link
Member Author

dhruvkb commented Oct 16, 2020

@kgodey the content changes so dynamically that we're seeing almost 24 bot commits a day. In cases like this, can we not justify the use of JavaScript?

@kgodey
Copy link
Member

kgodey commented Oct 16, 2020

@dhruvkb I don't see what bot commits have to do with JavaScript or the architecture of the project. In any case, I merged creativecommons/ccos-scripts#94 which should reduce bot commits.

@dhruvkb
Copy link
Member Author

dhruvkb commented Oct 16, 2020

@kgodey using JavaScript to fetch issues dynamically eliminates the need to keep a databag and sync it hourly. The data will always be fresh and up-to-date. Adding new filters (such as issues that need triage) is also easier because data is being fetched on demand from GitHub which would otherwise need another databag to be created and pushed hourly.

Copy link
Member

@akmadian akmadian left a comment

Choose a reason for hiding this comment

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

The code here looks great to me, I think I agree with Dhruv on the use of JS. I think that the advantages posed by using JS far outweigh the disadvantages. The JS used seems to be pretty standard so in terms of being reliant on it, it seems pretty innocuous.

I do agree that I don't like being dependent on third party packages any more than is needed, but the functionality seems worth it to me.

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

I am pleased with the changes and approach taken here. Nice work @dhruvkb

@dhruvkb
Copy link
Member Author

dhruvkb commented Nov 28, 2020

Now there's an option to find issues that have the label 🚦 status: awaiting triage.

While I agree 100% on @kgodey's points in favour of the static site, this JS based client-side approach proves how easy it is to extend the issue finder when adding new functionality.

@kgodey kgodey merged commit 9fcd5df into master Nov 29, 2020
@kgodey kgodey deleted the issue_finder_dyn branch November 29, 2020 22:33
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.

Migrate to the Search API for the Issue Finder Reduce commits by bot on the master branch
4 participants