-
Notifications
You must be signed in to change notification settings - Fork 234
54 lines (49 loc) · 2.27 KB
/
copy-documentation-issue.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# When the `documentation` label is added for documentation issues,
# this workflow copies the issue to the API team repo which can then
# be transferred to the feature team that owns the problem endpoint
# so they can resolve the documentation problem
# (we do not transfer the original issue so that the issue does not disappear for the contributor)
name: Copy documentation issue
on:
issues:
types:
- labeled
jobs:
copy-issue:
name: Copy documentation issue
runs-on: ubuntu-latest
if: github.event.label.name == 'documentation'
steps:
- name: priority
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
id: priority
with:
result-encoding: string
script: |
const labels = context.payload.issue.labels;
let priority = "unknown"
for (const label of labels) {
if (['P1','P2','P3','P4'].includes(label.name)){
priority = label.name
break
}
}
return priority
- name: Create an issue in the api-platform repo
run: |
new_issue_url="$(gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --repo github/api-platform --label "REST,openapi")"
echo 'NEW_ISSUE='$new_issue_url >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{secrets.ISSUE_TRANSFER_TOKEN}}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
- name: Comment on the new issue
run: |
gh issue comment $NEW_ISSUE --body "This issue was originally opened in the rest-api-description repo as $OLD_ISSUE with priority $PRIORITY on a scale of P1 (high) to P4 (low). Please transfer it to the appropriate feature team.
:exclamation: When you close this issue, also comment on and close the original issue.
:question: Was this issue something that could have been caught by a linter? If so, suggest a new rule in [#api-platform](https://github.slack.com/archives/C1042T6MS)."
env:
GITHUB_TOKEN: ${{secrets.ISSUE_TRANSFER_TOKEN}}
NEW_ISSUE: ${{ env.NEW_ISSUE }}
OLD_ISSUE: ${{ github.event.issue.html_url }}
PRIORITY: ${{ steps.priority.outputs.result }}