Skip to content

Commit b4c503f

Browse files
authored
Create copy-to-docs.yml
1 parent 774092c commit b4c503f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/copy-to-docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# For issues that should be fixed by the docs team,
2+
# this workflow copies the issue to the docs-content repo
3+
# when the `documentation` label is added
4+
# (we do not transfer so that the issue does not disappear for the contributor)
5+
6+
name: Copy to docs-content
7+
8+
on:
9+
issues:
10+
types:
11+
- labeled
12+
13+
jobs:
14+
copy-issue:
15+
name: Copy issue
16+
runs-on: ubuntu-latest
17+
if: github.event.label.name == 'documentation'
18+
steps:
19+
- name: priority
20+
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
21+
id: priority
22+
with:
23+
result-encoding: string
24+
script: |
25+
const labels = context.payload.issue.labels;
26+
let priority = "unknown"
27+
for (const label of labels) {
28+
if (['p0','p1','p2','p3'].includes(label.name)){
29+
priority = label.name
30+
break
31+
}
32+
}
33+
return priority
34+
35+
- name: Create an issue in the docs-content repo
36+
run: |
37+
new_issue_url="$(gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --repo github/docs-content)"
38+
echo 'NEW_ISSUE='$new_issue_url >> $GITHUB_ENV
39+
env:
40+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
41+
ISSUE_TITLE: ${{ github.event.issue.title }}
42+
ISSUE_BODY: ${{ github.event.issue.body }}
43+
44+
- name: Comment on the new issue
45+
run: |
46+
gh issue comment $NEW_ISSUE --body "This issue was originally opened in the rest-api-description repo as $OLD_ISSUE with priority $PRIORITY.
47+
:exclamation: When you close this issue, also comment on and close the original issue.
48+
:question: Was this issue something that could have been caught by a linter? If so, suggest a new rule in [#ecosystem-api](https://github.slack.com/archives/C1042T6MS)."
49+
env:
50+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
51+
NEW_ISSUE: ${{ env.NEW_ISSUE }}
52+
OLD_ISSUE: ${{ github.event.issue.html_url }}
53+
PRIORITY: ${{ steps.priority.outputs.result }}

0 commit comments

Comments
 (0)