Skip to content

Commit 3f51dc0

Browse files
authored
Merge pull request #3047 from github/becco/add-workflow
Add workflow to copy issues to `github/ecosystem-api`
2 parents 31e3181 + 270dcc5 commit 3f51dc0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Copy to ecosytem-api
2+
3+
on:
4+
issues:
5+
types:
6+
- labeled
7+
8+
jobs:
9+
copy-issue:
10+
name: Copy issue
11+
runs-on: ubuntu-latest
12+
if: github.event.label.name == 'feature'
13+
steps:
14+
- name: priority
15+
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
16+
id: priority
17+
with:
18+
result-encoding: string
19+
script: |
20+
const labels = context.payload.issue.labels;
21+
let priority = "unknown"
22+
for (const label of labels) {
23+
if (['P1','P2','P3','P4'].includes(label.name)){
24+
priority = label.name
25+
break
26+
}
27+
}
28+
return priority
29+
30+
- name: Create an issue in the ecosystem-api repo
31+
run: |
32+
new_issue_url="$(gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --repo github/ecosystem-api)"
33+
echo 'NEW_ISSUE='$new_issue_url >> $GITHUB_ENV
34+
env:
35+
GITHUB_TOKEN: ${{secrets.ISSUE_TRANSFER_TOKEN}}
36+
ISSUE_TITLE: ${{ github.event.issue.title }}
37+
ISSUE_BODY: ${{ github.event.issue.body }}
38+
39+
- name: Comment on the new issue
40+
run: |
41+
gh issue comment $NEW_ISSUE --body "This issue is an internal copy of $OLD_ISSUE, which was opened in the public [rest-api-description](https://github.com/github/rest-api-description) repo with priority $PRIORITY. Please transfer it to the appropriate feature team.
42+
43+
:exclamation: When you close this issue, please also comment on and close the original issue."
44+
env:
45+
GITHUB_TOKEN: ${{secrets.ISSUE_TRANSFER_TOKEN}}
46+
NEW_ISSUE: ${{ env.NEW_ISSUE }}
47+
OLD_ISSUE: ${{ github.event.issue.html_url }}
48+
PRIORITY: ${{ steps.priority.outputs.result }}

0 commit comments

Comments
 (0)