https://github.com/henrikac/github-repos
A shard that makes it easy to fetch data about specific repositories.
https://github.com/henrikac/github-repos
crystal crystal-lang crystal-language
Last synced: 8 months ago
JSON representation
A shard that makes it easy to fetch data about specific repositories.
- Host: GitHub
- URL: https://github.com/henrikac/github-repos
- Owner: henrikac
- License: mit
- Created: 2021-06-27T21:33:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-27T21:46:15.000Z (over 4 years ago)
- Last Synced: 2025-02-05T21:27:12.389Z (about 1 year ago)
- Topics: crystal, crystal-lang, crystal-language
- Language: Crystal
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-repos
A shard that makes it easy to fetch data about specific repositories.
This module was original made as part of a personal project which is why only a few properties has been added to `GitHub::Repo`, however, contributions are very welcome ;).
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
github-repos:
github: henrikac/github-repos
```
2. Run `shards install`
## Usage
Keep in mind that *"Unauthenticated clients can make 60 requests per hour"* [1](https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api#authentication).
```crystal
require "github-repos"
repos = GitHub.fetch_repos("henrikac", ["pokeapi", "github-repos", "prettytable"])
if repos.empty?
puts "Didn't find any repositories :'("
else
repos.each { |r| puts r.title }
end
```
The original purpose of this module was to fetch repository data every 5 minutes. By doing this the data displayed to potential users was always up-to-date.
```crystal
require "github-repos"
mut = Mutex.new
repos = Array(GitHub::Repo).new
spawn do
loop do
mut.lock
repos = GitHub.fetch_repos("henrikac", ["pokeapi", "github-repos", "prettytable"])
mut.unlock
sleep 5.minutes
end
end
# code ...
```
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Henrik Christensen](https://github.com/henrikac) - creator and maintainer