Git Product home page Git Product logo

good-first-issues's Introduction

Good First Issues

img/good-first-issues.png

A GitHub action to generate a web interface with an updated set of issues. This means that:

  • the interface is created under docs/
  • issues are populated in docs/_issues
  • the site is served via Jekyll

This means that you can use the action in your workflows too, and choose how often / when to run it, and how to update your GitHub pages. Continue reading to learn more.

Inputs

repos-file

Optional The path to the repos.txt (or otherwise named) file. Defaults to repos.txt in the root of the repository. The file should include a single list of repository URLS, and (optionally) one or more comma separated tags:

https://github.com/spack/spack hpc,package-management
https://github.com/singularityhub/sregistry containers,singularity

label

optional By default, the repository will filter down to issues labeled with "good first issue". However, you can change this by setting this variable to something else.

collection

optional By default, the issues will each produce a markdown file to add to the "docs" GitHub pages folder, in a subfolder named by this variable, which defaults to _issues. If you produce a site that has more than one collection, you can change this to something else.

Example usage

    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
    - name: Generate First Issues
      uses: rseng/[email protected]
      with:
        repos-file: '.github/repos.txt'
        token: ${{ secrets.GITHUB_TOKEN }}

You only need to define repos-file if you change the path (note that the above is changed from .github/repos.txt). It's highly recommended that you don't use master branch, but instead a version release or commit (as shown above). Here is how you might update the label used:

    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
    - name: Generate First Issues
      uses: rseng/[email protected]
      with:
        label: 'bug'
        token: ${{ secrets.GITHUB_TOKEN }}

Finally, if I want to instead output to a folder called _another (a Jekyll collection name) as a relative path to the docs folder, I can set that as follows:

    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
    - name: Generate First Issues
      uses: rseng/[email protected]
      with:
        collection: '_another'
        token: ${{ secrets.GITHUB_TOKEN }}

A full (realistic) workflow might look like the following:

name: good-first-issues

on:
  workflow_dispatch:
  schedule:
  - cron: 0 2 * * *
  - cron: 5 15 * * *
  - cron: 5 10 * * *
  - cron: 5 20 * * *
  push:
    branches:
      - main

jobs:
  good-first-issues:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Generate First Issues
      uses: rseng/[email protected]
      with:
        repos-file: '.github/repos.txt'
        token: ${{ secrets.GITHUB_TOKEN }}

    - name: Update Repository
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        UPDATE_BRANCH: "main"
      run: |
        printf "GitHub Actor: ${GITHUB_ACTOR}\n"
        git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
        git branch
        printf "Branch to push to is ${UPDATE_BRANCH}\n"
        git checkout ${UPDATE_BRANCH} || git checkout -b ${UPDATE_BRANCH}
        git branch
        git config --global user.name "github-actions"
        git config --global user.email "[email protected]"
        git pull origin ${UPDATE_BRANCH}
        git add docs/*
        git add docs/_issues/*
        if git diff-index --quiet HEAD --; then
           printf "No changes\n"
        else
           printf "Changes\n"
           git commit -m "Automated deployment to update first issues $(date '+%Y-%m-%d')"
           git push origin ${UPDATE_BRANCH}
        fi

Note that we use another step to push to our main branch. Actions cannot trigger other actions, so the workflow will not be triggered again.

Examples

Questions

How do I customize the interface?

The interface will always be generated in the docs subfolder, so if you haven't created it there yet, the action will generate it the first time around. It's up to you to add all or a subset of files in docs/* or docs/_issues after the content is generated. For example, you could add both docs and _issues in a next step that will commit to an existing or new branch:

git add docs/*
git add docs/_issues/*

This means that after the original docs is added and merged, you should be able to customize or otherwise update the template to your liking. The folder won't be edited if it already exists beyond the _issues folder.

Do you have an example? Please contribute by opening an issue or a pull request!

good-first-issues's People

Contributors

vsoch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

good-first-issues's Issues

The label should be a variable

It could be that the user wants to deploy an interface for some other label (aside from good-first-issue) so this should be exposed in the action, with a default of course the "good-first-issue" label.

known issue: edge case when n = 1

In the case that issues = 1, the loop doesn't function as we expect - it parses through the string instead of the list of issues. We need to add logic to the jekyll jinja2 parsing to check for this value, and if it's 1, to just render that one post and not assume a list.

Suggestion: leverage data formats

Noticing some parsing of the txt file is happening:

repo, extra_tags = line.strip().split(" ")
extra_tags = extra_tags.split(",")
repo = "/".join(repo.split("/")[-2:])

JSON/YAML could probably make this easier and self-documenting:

# json style
[
  {
    "owner": "organization",
    "name": "example-repo",
    "tags": ["hello", "world"]
  }
]

# yaml style
- owner: organization
  name: example-repo
  tags: [hello, world]

Likewise, I think it would be really useful to have an option to produce data output. Rather than directly going to front matter + markdown. Even if just internally in the python scripts.

Here's some pseudo code of what I mean in terms of interfaces.

type Filename = string;
type MarkdownContent = string;

interface ScriptFunctions {
  fetchRepos(path: Filename): Repository[];
  fetchIssues(repos: Repository[]): Map<Repository, Issue[]>;
  templateIssues(data: Map<Repository, Issue[]>): Map<Filename, MarkdownContent>;
  writeMarkdownFiles(files: Map<Filename, MarkdownContent>);
}

This would make it trivial to support writing JSON data out instead of MD files :]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.