masutaka / github-actions-all-in-one-project

Automatically add an issue or pull request to specific GitHub Project when you create them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

⚠️ This repository is obsolete. I recommend to use https://github.com/philschatz/project-bot.

GitHub Actions for all in one Project

Docker Automated buil Docker Stars Docker Pulls License

Automatically add an issue or pull request to specific GitHub Project when you create them.

Usage

Add the following settings to .github/main.workflow in your repository.

In addition you should probably use Automation for GitHub Projects.

Repository project

  1. Set the URL of repository project to PROJECT_URL
  2. Set column name you want issue/pull_request at the beginning to INITIAL_COLUMN_NAME

For issues

workflow "issues" {
  on       = "issues"
  resolves = ["Add an issue to project"]
}

action "Add an issue to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["GITHUB_TOKEN"]
  args    = ["issue"]

  env = {
    PROJECT_URL         = "https://github.com/masutaka/sandbox-github-actions/projects/2"
    INITIAL_COLUMN_NAME = "To do"
  }
}

For pull requests

workflow "pull_requests" {
  on       = "pull_request"
  resolves = ["Add a pull_request to project"]
}

action "Add a pull_request to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["GITHUB_TOKEN"]
  args    = ["pull_request"]

  env = {
    PROJECT_URL         = "https://github.com/masutaka/sandbox-github-actions/projects/2"
    INITIAL_COLUMN_NAME = "In progress"
  }
}

User owned project

  1. Set the URL of User owned project to PROJECT_URL
  2. Set column name you want issue/pull_request at the beginning to INITIAL_COLUMN_NAME
  3. Set secrets MY_GITHUB_TOKEN
    1. Create personal access token with repo scope on https://github.com/settings/tokens
    2. Create secret MY_GITHUB_TOKEN on https://github.com/USER/REPO_NAME/settings/secrets. The value is same to personal access token you created the above
    3. Set MY_GITHUB_TOKEN to secrets as follows:

For issues

workflow "issues" {
  on       = "issues"
  resolves = ["Add an issue to project"]
}

action "Add an issue to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["MY_GITHUB_TOKEN"]
  args    = ["issue"]

  env = {
    PROJECT_URL         = "https://github.com/users/masutaka/projects/2"
    INITIAL_COLUMN_NAME = "To do"
  }
}

For pull requests

workflow "pull_requests" {
  on       = "pull_request"
  resolves = ["Add a pull_request to project"]
}

action "Add a pull_request to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["MY_GITHUB_TOKEN"]
  args    = ["pull_request"]

  env = {
    PROJECT_URL         = "https://github.com/users/masutaka/projects/2"
    INITIAL_COLUMN_NAME = "In progress"
  }
}

Organization-wide project

  1. Set the URL of Organization-wide project to PROJECT_URL
  2. Set column name you want issue/pull_request at the beginning to INITIAL_COLUMN_NAME
  3. Set secrets MY_GITHUB_TOKEN
    1. Create personal access token with repo scope on https://github.com/settings/tokens
    2. Create secret MY_GITHUB_TOKEN on https://github.com/USER/REPO_NAME/settings/secrets. The value is same to personal access token you created the above
    3. Set MY_GITHUB_TOKEN to secrets as follows:

For issues

workflow "issues" {
  on       = "issues"
  resolves = ["Add an issue to project"]
}

action "Add an issue to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["MY_GITHUB_TOKEN"]
  args    = ["issue"]

  env = {
    PROJECT_URL         = "https://github.com/orgs/example/projects/2"
    INITIAL_COLUMN_NAME = "To do"
  }
}

For pull requests

workflow "pull_requests" {
  on       = "pull_request"
  resolves = ["Add a pull_request to project"]
}

action "Add a pull_request to project" {
  uses    = "docker://masutaka/github-actions-all-in-one-project:1.1.0"
  secrets = ["MY_GITHUB_TOKEN"]
  args    = ["pull_request"]

  env = {
    PROJECT_URL         = "https://github.com/orgs/example/projects/2"
    INITIAL_COLUMN_NAME = "In progress"
  }
}

About

Automatically add an issue or pull request to specific GitHub Project when you create them.

License:MIT License


Languages

Language:Shell 67.1%Language:HCL 21.8%Language:Dockerfile 11.1%