Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/konstin/github-wikidata-bot
Updates Wikidata entries using metadata from github
https://github.com/konstin/github-wikidata-bot
bot github-api wikidata wikidata-bot
Last synced: 13 days ago
JSON representation
Updates Wikidata entries using metadata from github
- Host: GitHub
- URL: https://github.com/konstin/github-wikidata-bot
- Owner: konstin
- License: other
- Created: 2016-12-13T21:09:38.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-11-20T09:34:50.000Z (about 1 month ago)
- Last Synced: 2024-11-30T16:12:00.088Z (25 days ago)
- Topics: bot, github-api, wikidata, wikidata-bot
- Language: Python
- Homepage: https://www.wikidata.org/wiki/User:Github-wiki-bot
- Size: 582 KB
- Stars: 41
- Watchers: 9
- Forks: 8
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
README
# GitHub to Wikidata bot
![Tests](https://github.com/konstin/github-wikidata-bot/workflows/Tests/badge.svg)
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 linkIt is possible to [exclude items](https://www.wikidata.org/wiki/User:Github-wiki-bot/Exceptions) from being edited by the bot, and also to [allow using tags](https://www.wikidata.org/w/index.php?title=User:Github-wiki-bot/Whitelist) for projects without GitHub releases.
## Setup and usage
First install python 3.12 and [poetry][poetry], then run `poetry install`.
[Generate a personal access token on GitHub][github-token]. Create a `config.json` file with that token and your Wikidata username:
```json
{
"username": "my-wikidata-username",
"github-oauth-token": "abcdedf1234567"
}
```Then run `main.py` in a terminal and enter the password for your bot account.
Run `pytest`, `ruff format` and `ruff check` after making code changes.
## 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][repo-property] 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][no-repo-query]
to determine entities without a repository.## Statistics
You can find detailed statistics on [wmflabs][wmflabs].
[poetry]: https://github.com/sdispater/poetry
[github-token]: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
[repo-property]: https://www.wikidata.org/wiki/Property:P1324
[no-repo-query]: https://github.com/konstin/github-wikidata-bot/blob/master/free_software_without_repository.rq
[wmflabs]: https://xtools.wmflabs.org/ec/wikidata/Github-wiki-bot
[logs]: https://gist.github.com/konstin/9b90ae895ad9a270102415474a56e613