You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 11, 2023. It is now read-only.
Use this template to bootstrap the creation of a JavaScript action.:rocket:
7
+
This is a GitHub Action to mirror columns in hierarchically modeled GitHub Projects.
8
8
9
-
This template includes compilication support, tests, a validation workflow, publishing, and versioning guidance.
9
+
As an example, let's assume a scenario where there are issues used to document both epic and feature level scopes of work, where features belong to epics.
10
10
11
-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
11
+
In this scenario, we have two project boards to individually track and give visibility into epics and features individually. Each project board has the following columns:
12
+
- backlog
13
+
- active
14
+
- done
12
15
13
-
## Create an action from this template
16
+
If individual teams, or individual roles within a team, are only looking at the feature board then it can be hard to tell what epics are actively being worked on.
14
17
15
-
Click the `Use this Template` and provide the new repo details for your action
18
+
This action makes this scenario easier by actively mirroring columns across project boards. We can create an `active epics` column on the feature board that will automatically stay up to date with the `active` column on the epics project board.
16
19
17
-
## Code in Master
20
+
## Usage
18
21
19
-
Install the dependencies
20
-
```bash
21
-
$ npm install
22
-
```
22
+
The action is intended to be run on a cron schedule, see [mirror.yml](./.github/workflows/mirror.yml) for an example. The linked action workflow also uses the `push` event trigger for testing purposes only, and is not generally recommended for use.
23
23
24
-
Build the typescript and package it for distribution
25
-
```bash
26
-
$ npm run build && npm run pack
27
24
```
28
-
29
-
Run the tests :heavy_check_mark:
30
-
```bash
31
-
$ npm test
32
-
33
-
PASS ./index.test.js
34
-
✓ throws invalid number (3ms)
35
-
✓ wait 500 ms (504ms)
36
-
✓ test runs (95ms)
37
-
38
-
...
25
+
on:
26
+
schedule:
27
+
cron:
28
+
# cron actions will not run more frequently than once every 5 minutes
29
+
- '*/5 * * * *'
30
+
jobs:
31
+
mirror_column:
32
+
runs-on: ubuntu-latest
33
+
steps:
34
+
- uses: actions/checkout@v2
35
+
- uses: jonabc/linked-project-columns@<version>
36
+
with:
37
+
source_column_id: <column node id>
38
+
target_column_id: <column node id>
39
+
github_token: ${{ secrets.MIRROR_SECRET_PAT }}
39
40
```
40
41
41
-
## Change action.yml
42
-
43
-
The action.yml contains defines the inputs and output for your action.
44
-
45
-
Update the action.yml with your name, description, inputs and outputs for your action.
46
-
47
-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
42
+
### Added notice card
48
43
49
-
## Change the Code
44
+
The action will add a notice to the top of the target project column, identifying the source project column and notifying users that the column is automatically managed.
50
45
51
-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
46
+
### Required permissions
52
47
53
-
```javascript
54
-
import*ascorefrom'@actions/core';
55
-
...
48
+
The `${{ secrets.GITHUB_TOKEN }}` token can be used only when all project columns being accessed live in the target repository. For organization or user owned projects, a personal access token will need to be used that has the following permissions at a minimum:
49
+
1.`write:org` to update organization projects
50
+
2.`repo` to access information in private repositories
51
+
3.`user` to access information in user repositories (if needed)
56
52
57
-
asyncfunctionrun() {
58
-
try {
59
-
...
60
-
}
61
-
catch (error) {
62
-
core.setFailed(error.message);
63
-
}
64
-
}
53
+
### Filtering cards mirroring
65
54
66
-
run()
67
-
```
68
-
69
-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
55
+
Cards can be filtered from mirroring by specifying additional inputs on the action workflow.
70
56
71
-
## Publish to a distribution branch
57
+
**type_filter**
72
58
73
-
Actions are run from GitHub repos so we will checkin the packed dist folder.
74
-
75
-
Then run [ncc](https://github.com/zeit/ncc) and push the results:
76
-
```bash
77
-
$ npm run pack
78
-
$ git add dist
79
-
$ git commit -a -m "prod dependencies"
80
-
$ git push origin releases/v1
81
-
```
59
+
Filters mirrored cards only to the specified type. Must be one of
60
+
-`content` (linked issue or PR)
61
+
-`note`
82
62
83
-
Your action is now published! :rocket:
63
+
**label_filter**
84
64
85
-
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
65
+
Filters mirrored cards based labels that match the input. Note cards cannot be tagged with labels, and will never be filtered based on this input.
86
66
87
-
## Validate
88
-
89
-
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)])
90
-
91
-
```yaml
92
-
uses: ./
93
-
with:
94
-
milliseconds: 1000
95
-
```
67
+
Label filters use exact, case sensitive comparisons to determine whether to mirror a card. Label filter inputs can contain multiple labels separated by commas (`'first, second'`), and will be mirrored if any labels match (i.e. `OR` logic).
96
68
97
-
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
69
+
**content_filter**
98
70
99
-
## Usage:
71
+
Filters mirrored cards based on the displayed card content. Issue/PR titles is evaluated when they are linked as cards, otherwise the card's note text is used.
100
72
101
-
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
73
+
Content filters use partial, case insensitive comparisons when determining which cards to mirror. Content filter inputs can contain multiple filters separated by commas (`'first, second'`), and will be mirrored if any content matches are found (i.e. `OR` logic). Content filters containing commas must be wrapped in quotes (`'first, second, "matching, with a comma"'`)
0 commit comments