Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

526 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub to Wikidata bot

Update Wikidata entries using metadata from GitHub.

For free software projects with a GitHub repository listed in Wikidata, this script will perform the following steps, using metadata collected from the GitHub API:

  • Import all stable releases and the release dates, including release data, source, and a source title
  • Update the project website
  • Normalize the GitHub link

It is possible to exclude items from being edited by the bot, and also to allow using tags for projects without GitHub releases.

Setup and usage

Install uv and install the dependencies:

uv sync

Generate a personal access token on GitHub and a bot password. Create a config.json file with the GitHub token, your usename, the bot name and the bot password:

{
  "username": "my-wikidata-username",
  "bot-name": "my-wikidata-bot",
  "password": "my-bot-password-32-chars-long",
  "github-oauth-token": "abcdedf1234567"
}

Run the bot in a terminal and enter the password for your bot account:

uv run main.py

Run pytest, ruff format, ruff check and ty check after making code changes:

uv run ruff format && uv run ruff check && uv run ty check && uv run pytest

Implementation notes

First, a SPARQL query gathers all the free software projects in Wikidata which have a GitHub repository specified in the source code repository property. For each entry, a cached request to the GitHub API is made, which is authenticated by the OAuth key. The wikidata entries are then inserted using a "exists or insert" logic. For each entry, the GitHub api link is added as reference.

Why does the bot not work for item Q…?

  • Does the entity already have a VCS repository set? Use this query to determine entities without a repository.

Statistics

You can find detailed statistics on wmflabs.

About

Updates Wikidata entries using metadata from github

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages