Skip to content

Instantly share code, notes, and snippets.

@mrakitin
Created October 1, 2021 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrakitin/48e85bcfab58770739b861803fc6a891 to your computer and use it in GitHub Desktop.
Save mrakitin/48e85bcfab58770739b861803fc6a891 to your computer and use it in GitHub Desktop.
import os
from github import Github
token = os.getenv("GITHUB_ACCESS_TOKEN")
gh_org = os.getenv("GITHUB_ORG_UPDATE_TOPICS", "bluesky")
g = Github(token)
all_repos = {}
for repo in g.get_organization(gh_org).get_repos():
print(repo.name)
all_repos[repo.name] = repo
add_topics = ["hacktoberfest", "hacktoberfest2021"]
for name, repo in all_repos.items():
if (
name.startswith(("bluesky", "suitcase"))
or name in ["ophyd", "databroker", "databroker-pack"]
) and not repo.archived:
topics = repo.get_topics()
print(f"{name}: {topics}")
if not set(topics).intersection(add_topics):
print(f"\t{name} does not have {add_topics}. To be updated...")
topics += add_topics
print(f"\tUpdated topics: {topics}\n")
repo.replace_topics(topics)
else:
print(f"\t{name} has {add_topics}. To be skipped.\n")
@mrakitin
Copy link
Author

mrakitin commented Oct 1, 2021

Requirements:

$ pip install pygithub

Sample output:

$ python github-update-topics.py 
ophyd
bluesky
suitcase-core
databroker
tutorials
event-model
hklpy
suitcase-cookiecutter
suitcase-csv
bluesky-slides
intake-bluesky
suitcase-tiff
suitcase-utils
suitcase-mongo
suitcase-json-metadata
suitcase-jsonl
intake-bluesky-demos
suitcase-specfile
bluesky-ui
bluesky.github.io
bluesky-browser
suitcase-msgpack
bluesky-enhancement-proposals
suitcase-server
suitcase-zarr
bluesky-kafka
project-status-dashboard
bluesky-spreadsheet
bluesky-darkframes
suitcase-nxstxm
area-detector-handlers
bluesky-diffraction-demo
ophyd-tango
suitcase-dataexchange
archiver-rucio
bluesky-mpl
bluesky-queueserver
resource-health-check
accumulate-fill-publish
pizzabox-handlers
databroker-pack
yaqc-bluesky
suitcase-nxsas
ansible-kafka
bluesky-cartpole
bluesky-adaptive
bluesky-widgets
bluesky-pods
databroker-server
data-samples
bluesky-vagrant
databroker-client
ansible-mongo
bluesky-webclient
bluesky-live
hkl-notebooks
tiled
ansible-mongo-standalone
tutorial-adaptive-RL-sampling
tutorial-anomaly-time-series
tutorial-cookiecutter
tutorial-boost-beamtime-productivity
tutorial-xafs
tutorial-hello-bluesky
AutomatingMongoDBWithAnsible
bluesky-httpserver
ophyd: ['epics', 'python', 'control-systems', 'hacktoberfest', 'hacktoberfest2021']
	ophyd has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky: ['python', 'bluesky', 'dataacquisition', 'hacktoberfest', 'hacktoberfest2021']
	bluesky has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-core: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-core has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

databroker: ['hacktoberfest', 'hacktoberfest2021']
	databroker has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-cookiecutter: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-cookiecutter has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-csv: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-csv has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-slides: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-slides has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-tiff: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-tiff has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-utils: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-utils has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-mongo: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-mongo has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-json-metadata: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-json-metadata has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-jsonl: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-jsonl has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-specfile: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-specfile has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-ui: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-ui has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky.github.io: ['hacktoberfest', 'hacktoberfest2021']
	bluesky.github.io has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-msgpack: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-msgpack has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-enhancement-proposals: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-enhancement-proposals has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-server: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-server has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-zarr: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-zarr has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-kafka: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-kafka has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-spreadsheet: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-spreadsheet has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-darkframes: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-darkframes has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-nxstxm: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-nxstxm has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-diffraction-demo: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-diffraction-demo has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-dataexchange: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-dataexchange has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-queueserver: ['bluesky', 'bluesky-queueserver', 'bluesky-webclient', 'hacktoberfest', 'hacktoberfest2021']
	bluesky-queueserver has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

databroker-pack: ['hacktoberfest', 'hacktoberfest2021']
	databroker-pack has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

suitcase-nxsas: ['hacktoberfest', 'hacktoberfest2021']
	suitcase-nxsas has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-cartpole: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-cartpole has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-adaptive: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-adaptive has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-widgets: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-widgets has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-pods: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-pods has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-vagrant: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-vagrant has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-webclient: ['bluesky', 'bluesky-webclient', 'bluesky-queueserver', 'hacktoberfest', 'hacktoberfest2021']
	bluesky-webclient has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-live: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-live has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

bluesky-httpserver: ['hacktoberfest', 'hacktoberfest2021']
	bluesky-httpserver has ['hacktoberfest', 'hacktoberfest2021']. To be skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment