-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceaf67c
commit eaff6ff
Showing
1 changed file
with
12 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,34 @@ | ||
# Issue Card Creator | ||
## Label Issue and Add to Project | ||
This GitHub Action is written in JavaScript, though its purpose is fairly specific. For organization-level GitHub projects that specifically use the projects beta, it will automatically take issues as they're created, label them, and then add them to the project. | ||
|
||
This is a GitHub Action written in JavaScript. It allows you to automatically create a project card for an issue when it's created. It supports both repo-level projects and org-level projects. | ||
**Note:** It requires you to set have an organization-level secret called `ACCESS_TOKEN`, and the value should be an access token that allows you to read at the organization level, and write at the individual repo level. | ||
|
||
The `main.yml` has an `actions` input, which allows you to customize which issue labels should map to which project/org/column. Here's an example that uses both repo-level and org-level projects: | ||
Example YML: | ||
``` | ||
actions: '{"data": [ | ||
{ | ||
"label": "test", | ||
"project": "Ultra Project", | ||
"project_type": "repo", | ||
"column": "To-Do", | ||
"repo": "super-repo" | ||
}, | ||
{ | ||
"label": "wontfix", | ||
"project": "Mega Project", | ||
"project_type": "org", | ||
"column": "Icebox", | ||
"org": "ultra-important-org" | ||
} | ||
]}' | ||
``` | ||
|
||
|
||
# Accessing Organization-level Projects | ||
By default, the access token that GitHub generates for an action is limited to only the repo that the action is added to. Meaning, you can't get data for other repos; only the one the action is added to. However, it's possible to use a custom access token that allows you to access those other repos. | ||
|
||
First, you need to create an Organization Secret called `ACCESS_TOKEN`, and set the value to the access token you want to use. | ||
|
||
Once you've done that, you'll need to add `github-token: ${{ secrets.ACCESS_TOKEN }}` to your `main.yml`. See below for examples. | ||
|
||
|
||
|
||
|
||
|
||
## Example main.yml (default permissions) | ||
``` | ||
on: | ||
issues: | ||
types: [opened] | ||
jobs: | ||
issue_creator_job: | ||
runs-on: ubuntu-latest | ||
name: Issue card handler | ||
name: Label issue and add to project | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Issue Card Creator | ||
uses: somnolentPumpkin/issue-card-creator@1.24 | ||
- name: Label issue and add to project | ||
uses: somnolentPumpkin/issue-card-creator-and-labeler@0.96 | ||
id: hello | ||
with: | ||
github-token: ${{ secrets.ACCESS_TOKEN }} | ||
actions: '{"data": [ | ||
{ | ||
"label": "test", | ||
"project": "Project 2", | ||
"project_type": "org", | ||
"column": "Column 2", | ||
"org": "qe-test-org" | ||
}, | ||
{ | ||
"label": "bug", | ||
"project": "Super Project", | ||
"project_type": "repo", | ||
"column": "Super Column", | ||
"repo": "Ultra-Repo" | ||
"label": "Bugs", | ||
"project": "1", | ||
"repo": "your-repo", | ||
"org": "your-org-name" | ||
} | ||
]}' | ||
``` | ||
|
||
## Example main.yml (custom access token) | ||
``` | ||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
issue_creator_job: | ||
runs-on: ubuntu-latest | ||
name: Issue card handler | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Issue Card Creator | ||
uses: somnolentPumpkin/issue-card-creator@1.24 | ||
id: hello | ||
with: | ||
github-token: ${{ secrets.ACCESS_TOKEN }} | ||
actions: '{"data": [ | ||
{ | ||
"label": "test", | ||
"project": "Project 2", | ||
"project_type": "org", | ||
"column": "Column 2", | ||
"org": "qe-test-org" | ||
}, | ||
{ | ||
"label": "bug", | ||
"project": "Super Project", | ||
"project_type": "repo", | ||
"column": "Super Column", | ||
"repo": "Ultra-Repo" | ||
} | ||
]}' | ||
``` |