Help us shape the future of Go! Take the 2026 Go Developer Survey

caretaker

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

Caretaker

caretaker

Caretaker automates project ( beta ) based processes.

The following automation options are available at the moment of writing.

Periodic pull request scanning

Caretaker can track pull request activity. It does that by checking the last activity on the pull request. It compares that date with an interval set by the user, by default 24 hours. If the last activity was later than that, it will automatically move any issues that are attached to the pull request into a desired Status ( column on a board view ).

An example action could look something like this:

name: Scan Pull Request Activity

on:
  schedule:
    - cron:  '0 1 * * *'

permissions:
  contents: read
  issues: read

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - name: scan pull request activity
        uses: skarlso/caretaker@v0.1.0
        with:
          command: stale
          owner: skarlso
          repo: test
          token: ${{ secrets.PROJECT_TOKEN }}
          statusOption: In Review # this needs to be an option you want the issue to land in
          pullRequestProcessedLabel: caretaker-checked # a label to mark the pull request as seen

If the owner of the repository is an organization, please set isOrganization: true in with.

Required Labels

Caretaker checks for a specific label to be present on the Pull Request it already checked, so it can skip it. This label can be defined via with: pullRequestProcessedLabel. This label is deleted during Automatic Issue back-flipping on pull request activity.

Automatic Issue back-flipping on pull request activity

With the following action, Caretaker can flip-back issues into a desired state upon any activity on a pull request. The activity type can be defined by the action.

name: Flip-back issues to In Progress

on:
  pull_request: {}

jobs:
  flip:
    runs-on: ubuntu-latest
    steps:
      - name: flip any related issues
        uses: skarlso/caretaker@v0.1.0
        with:
          command: move-issue
          owner: skarlso
          repo: test
          token: ${{ secrets.PROJECT_TOKEN }}
          statusOption: In Progress # this needs to be an option you want the issue to land in
          pullRequestNumber: ${{ github.event.pull_request.number }}

Assigning Issues created to a Project

You can auto assign any issues that are created to a specific Project.

name: Assign to Project

on:
  issues:
    types: [opened]

permissions:
  contents: read
  issues: read

jobs:
  assign:
    runs-on: ubuntu-latest
    steps:
      - name: assign issue to project
        uses: skarlso/caretaker@v0.1.0
        with:
          command: assign-issue
          owner: skarlso
          repo: test
          token: ${{ secrets.PROJECT_TOKEN }}
          issueNumber: ${{ github.event.issue.number }}
          projectNumber: 2 # the number of the project to assing this issue to.

Note: This will be further extended to add potential default labels to the issue automatically after its creation.

Authentication

Since ProjectV2 at the time of this writing, isn't in the scope of the GITHUB_TOKEN, a generated token must be used with org level read access.

Up-coming

For any other features which might be of use, please create a Feature Request.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
client/fakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL