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

automate skill label in skills.json #122

Merged
merged 15 commits into from
Mar 13, 2021

Conversation

Cronus1007
Copy link
Member

@Cronus1007 Cronus1007 commented Jan 29, 2021

Fixes

Related to #86 by @dhruvkb

Description

Technical details

Tests

Screenshots

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.

@Cronus1007 Cronus1007 marked this pull request as draft January 29, 2021 10:14
@Cronus1007 Cronus1007 mentioned this pull request Feb 1, 2021
1 task
@Cronus1007 Cronus1007 marked this pull request as ready for review February 8, 2021 08:24
@TimidRobot TimidRobot self-assigned this Feb 19, 2021
Copy link
Member

@TimidRobot TimidRobot left a comment

Choose a reason for hiding this comment

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

Please do:

  1. Add Black and Flake8 (and use them to update code)
  2. Add support for ADMIN_GITHUB_TOKEN environment variable
  3. Ensure all files have an end of file newline

Please consider:

  • pretty formatting skills.json (maybe all you have to do is include indent=2)

sync_community_skills/Pipfile Outdated Show resolved Hide resolved
sync_community_skills/Pipfile Show resolved Hide resolved
sync_community_skills/skills.json Outdated Show resolved Hide resolved
Copy link
Member

@TimidRobot TimidRobot left a comment

Choose a reason for hiding this comment

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

The script still needs authentication.

Also, I think it would be better if it used PyGithub instead of requests.

here is a starting point:

#!/usr/bin/env python3
# vim: set fileencoding=utf-8:

# Standard library
import json
import os

# Third party
from github import Github


GITHUB_ORGANIZATION = "creativecommons"
GITHUB_TOKEN = os.environ["ADMIN_GITHUB_TOKEN"]


github_client = Github(GITHUB_TOKEN)
cc = github_client.get_organization(GITHUB_ORGANIZATION)
repos = list(cc.get_repos())
repos.sort(key=lambda repo: repo.name)
data = []
for repo in repos:
    data.append({"name": repo.name, "languages": repo.get_languages()})
print(json.dumps(data, indent=2, sort_keys=True))

Please also consider:

  • pretty formatting JSON (ex. indent=2, sort_keys=True)
  • adding exception handling (ex. normalize_repos.p L33-L37 and L180-L196

sync_community_skills/get_community_skills.py Outdated Show resolved Hide resolved
sync_community_skills/get_community_skills.py Show resolved Hide resolved
@Cronus1007 Cronus1007 changed the title automate skill label in console.log automate skill label in skills.json Mar 5, 2021
Copy link
Member

@TimidRobot TimidRobot left a comment

Choose a reason for hiding this comment

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

Good work! See comments for requested changes

sync_community_skills/.flake8 Outdated Show resolved Hide resolved
sync_community_skills/get_community_skills.py Outdated Show resolved Hide resolved
sync_community_skills/get_community_skills.py Outdated Show resolved Hide resolved
sync_community_skills/get_community_skills.py Outdated Show resolved Hide resolved
sync_community_skills/get_community_skills.py Show resolved Hide resolved
sync_community_skills/Pipfile Outdated Show resolved Hide resolved
sync_community_skills/Pipfile Outdated Show resolved Hide resolved
Copy link
Member

@TimidRobot TimidRobot left a comment

Choose a reason for hiding this comment

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

this is great work! thank you!

i changed it so that it won't close the issue as i need to determine how i want the system as a whole to function. i expect this code will probably be integrated into push_data_to_ccos.

@TimidRobot TimidRobot merged commit d8e9b94 into creativecommons:master Mar 13, 2021
@Cronus1007 Cronus1007 deleted the skills branch March 14, 2021 16:46
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.

2 participants