GithubHelp home page GithubHelp logo

lee-dohm / team-rotation Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 1.8 MB

A GitHub Action to determine the next person in a team rotation

License: MIT License

TypeScript 92.45% JavaScript 1.90% Shell 5.65%
action

team-rotation's Introduction

Team Rotation

A GitHub Action to determine the next team member in a rotation.

Use

This GitHub Action is meant to be used to assist with creating issues or PRs for tasks that rotate through a team. For example:

# .github/workflows/weekly-issue
on:
  schedule:
    - cron: 0 20 * * 2
name: Create weekly issue
jobs:
  stuff:
    steps:
      - uses: lee-dohm/last-assigned@v1
        with:
          query: 'label:weekly-issue'
          token: ${{ secrets.GITHUB_TOKEN }}
        id: assigned
      - uses: lee-dohm/team-rotation@v1
        with:
          last: ${{ steps.assigned.outputs.last }}
          include: octocat lee-dohm
        id: rotation
      - uses: JasonEtco/create-an-issue@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          filename: .github/weekly-issue-template.md
          assignees: ${{ steps.rotation.outputs.next }}

This workflow:

  1. Gets the person that was assigned to the last issue opened that matches the query label:weekly-issue
  2. Determines the next person in the team rotation after the person found in step 1
  3. Creates a new issue based on the .github/weekly-issue-template.md template and assigns the person found in step 2

Inputs

  • exclude -- Space-separated list of GitHub handles to remove from the list
  • include -- Space-separated list of GitHub handles to add to the list generated by teamName, if any
  • last -- GitHub handle of the last person to be assigned from the rotation
  • teamName -- The name of a GitHub team, ex: @org-name/team-name. If this parameter is specified, token is required.
  • token -- Token to use to perform the query of members in teamName. Please note: Because the default GITHUB_TOKEN doesn't have access to query organization team members, you'll have to create a personal access token with access to organization information and create a secret for it

Outputs

  • next -- GitHub handle of the next person in the rotation

Logic

The next person in the rotation is determined by:

  1. Getting the list of handles associated with teamName, if any
  2. Adding any handles from include
  3. Removing any handles in exclude
  4. Removing any duplicates in the list
  5. Sorting the list alphabetically
  6. Finding the handle specified in last in the list
  7. Taking the next handle in the list, if there are no more in the list, use the first handle in the list

License

MIT

team-rotation's People

Contributors

dependabot[bot] avatar lee-dohm avatar github-actions[bot] avatar dependabot-preview[bot] avatar

Watchers

James Cloos avatar  avatar

Forkers

ttomsu kaawatea

team-rotation's Issues

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.