Skip to content

Commit 385529c

Browse files
committed
add docs
1 parent 5968eaa commit 385529c

File tree

1 file changed

+60
-14
lines changed

1 file changed

+60
-14
lines changed

README.md

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,30 @@ This action integrates asana with github.
2222

2323
**Optional** Prefix before the task i.e ASANA TASK: https://app.asana.com/1/2/3/.
2424

25-
### `task-comment`
25+
### `text`
2626

27-
**Optional** If any comment is provided, the action will add a comment to the specified asana task with the text & pull request link.
27+
**Required for `add-comment`** If any comment is provided, the action will add a comment to the specified asana task with the text.
28+
29+
### `comment-id`
30+
31+
**Required for `remove-comment`, Optional for `add-comment`** When provided in add-comment, gives a unique identifier that can later be used to delete the comment
2832

2933
### `targets`
3034

31-
**Optional** JSON array of objects having project and section where to move current task. Move task only if it exists in target project. e.g
35+
**Required for `move-section`** JSON array of objects having project and section where to move current task. Move task only if it exists in target project. e.g
3236
```yaml
3337
targets: '[{"project": "Backlog", "section": "Development Done"}, {"project": "Current Sprint", "section": "In Review"}]'
3438
```
3539
if you don't want to move task omit `targets`.
3640

3741
### `link-required`
3842

39-
**Optional** When set to true will fail pull requests without an asana link
43+
**Required for `assert-link`** When set to true will fail pull requests without an asana link
4044

4145
## Example usage
4246

4347
```yaml
44-
name: Mark asana task as done
48+
name: Move a task to a different section
4549
4650
on:
4751
pull_request:
@@ -51,17 +55,16 @@ jobs:
5155
sync:
5256
runs-on: ubuntu-latest
5357
steps:
54-
- uses: everphone-gmbh/github-asana-action@v3.0.0
58+
- uses: everphone-gmbh/github-asana-action
5559
if: github.event.pull_request.merged
5660
with:
5761
asana-pat: ${{ secrets.ASANA_PAT }}
62+
action: 'move-section'
5863
targets: '[{"project": "Engineering scrum", "section": "Done"}]'
59-
link-required: false
60-
github-token: ${{ secrets.GITHUB_TOKEN }}
6164
```
6265

6366
```yaml
64-
name: Add asana link
67+
name: Add a comment
6568
6669
on:
6770
pull_request:
@@ -71,12 +74,55 @@ jobs:
7174
sync:
7275
runs-on: ubuntu-latest
7376
steps:
74-
- uses: everphone-gmbh/[email protected]
77+
- name: set pr number
78+
run: echo "::set-env name=PR_NUMBER::$(echo -n "${GITHUB_REF}" | awk 'BEGIN { FS = "/" } ; { print $3 }')"
79+
- uses: everphone-gmbh/github-asana-action
7580
with:
7681
asana-pat: ${{ secrets.ASANA_PAT }}
77-
task-comment: 'View Pull Request Here: '
78-
# if the branch is labeled or named a hotfix, skip this check
79-
link-required: ${{ !contains(github.event.pull_request.labels.*.name, 'hotfix') && !startsWith(github.event.pull_request.title,'hotfix/') }}
80-
github-token: ${{ secrets.GITHUB_TOKEN }}
82+
action: 'add-comment'
83+
comment-id: "#pr:${{env.PR_NUMBER}}"
84+
text: 'View Pull Request: https://github.com/everphone-gmbh/frontend-symfony/pull/${{env.PR_NUMBER}}'
85+
is-pinned: true
86+
```
87+
88+
```yaml
89+
name: Remove a comment
8190
91+
on:
92+
pull_request:
93+
types: [closed]
94+
95+
jobs:
96+
sync:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: set pr number
100+
run: echo "::set-env name=PR_NUMBER::$(echo -n "${GITHUB_REF}" | awk 'BEGIN { FS = "/" } ; { print $3 }')"
101+
- uses: everphone-gmbh/github-asana-action@5968eaa
102+
if: github.event.pull_request.merged
103+
with:
104+
asana-pat: ${{ secrets.ASANA_PAT }}
105+
action: 'remove-comment'
106+
comment-id: "#pr:${{env.PR_NUMBER}}"
107+
```
108+
109+
```yaml
110+
name: Validate asana link presence
111+
112+
on:
113+
pull_request:
114+
# revalidate on label changes
115+
types: [opened, edited, labeled, unlabeled]
116+
117+
jobs:
118+
sync:
119+
runs-on: ubuntu-latest
120+
steps:
121+
- uses: everphone-gmbh/github-asana-action
122+
with:
123+
asana-pat: ${{ secrets.ASANA_PAT }}
124+
action: assert-link
125+
# if the branch is labeled or hotfix, skip this check
126+
link-required: ${{ !contains(github.event.pull_request.labels.*.name, 'hotfix') }}
127+
github-token: ${{ github.token }}
82128
```

0 commit comments

Comments
 (0)