/gleam_contributors

Primary LanguageGleamApache License 2.0Apache-2.0

gleam_contributors

A Gleam program that queries the Github v4 GraphQL API to request the Gleam project's list of contributors and sponsors.

Quick start

# Build the project
gleam build #OR
gleam run

# Run the eunit tests
gleam test

# Run the program! 
gleam run $TOKEN $FROM_VERSION $TO_VERSION

Note that $TO_VERSION is optional, and will default to the current datetime if not given.

To autogenerate a list of sponsors in file using Github Actions:

This will generate a list of everyone who sponsors you over $10 per month

  1. Set up your repo to perform github actions (Link required)
  2. Add your github token to the repo secrets (Link required)
  3. In the root directory of the file you want to autogenerate, in folder .github/workflows/ create a yaml file with the following code
name: Sponsors List

# Controls when the action will run.
# Can set to on: push for example.
# This will run every 15 minutes!
on:
  schedule:
    - cron:  '*/15 * * * *'

jobs:
  readme_edit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: gleam-lang/setup-erlang@v1.0.0
      with:
        otp-version: 23.0
    - uses: gleam-lang/setup-gleam@v1.0.1
      with:
        gleam-version: 0.18.0-rc3
    - name: Clones gleam_contributors
      run: |
        git clone https://github.com/scripttease/gleam_contributors.git
        cd gleam_contributors
        gleam build
        gleam test
        gleam format --check src test
    - name: Adds Sponors to README
      run: |
        gleam run readme-list $API_TOKEN README.md
    # Runs a set of commands using the runners shell
    - name: Commits and pushes updated README
      run: |
        git add README.md
        git config user.email scripttease@users.noreply.github.com
        git config user.name Al Dee
        git commit README.md -m 'Update README.md with test Cron job' || echo "Update README.md failed"
        git push origin || echo "Push Failed"
  1. In the name of the file that you wish to put your sponsors list, add the following code (For example, in the README.md) Then COMMENT OUT THE LINE! The file should be a markdown file.
Below this line this file is autogenerated
  1. If you wish to instead run the sponsors list generator from the command line use:
gleam run readme-list $FILENAME

readme-list is a tag, it does not need to be in quotes. If you run the command from the root directory containing FILENAME.md, and if it has the commented out line shown above, the sponsor list will be generated as shown below as a series of avatar images.

# To generate sponsor list from command line:
gleam run readme-list $FILENAME

Here's what it looks like in action: