Skip to content

Commit 5084796

Browse files
committed
make the workflow generic
1 parent 421f5ac commit 5084796

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

.github/workflows/create-docs-issue.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
1-
name: Create Documentation Linear Issue
1+
name: Create Linear Issue on PR Merge
22

33
on:
44
workflow_call:
5+
inputs:
6+
label:
7+
required: true
8+
description: The PR label which should trigger an issue being created.
9+
type: string
10+
issue-prefix:
11+
required: false
12+
description: A prefix to add to the issue title.
13+
default: "AUTO-GENERATED"
514
secrets:
615
linear-api-key:
716
required: true
8-
description: An API key to use to create an issue for documentation.
9-
linear-label-id:
17+
description: An API key to use to create an issue.
18+
issue-label-id:
1019
required: true
11-
description: The ID of the label to be added to the issue.
12-
linear-docs-team-id:
20+
description: The ID of a pre-existing label to add to the created issue.
21+
issue-team-id:
1322
required: true
14-
description: The ID of the documentation team in Linear.
23+
description: The ID of the team to create the issue under within Linear.
1524

1625
jobs:
1726
create-issue:
1827
if: >
1928
github.event.pull_request.merged == true &&
20-
contains(github.event.pull_request.labels.*.name, 'docs: needed')
29+
contains(github.event.pull_request.labels.*.name, ${{ inputs.label }})
2130
runs-on: ubuntu-latest
2231
steps:
2332
- name: Create Linear Issue
2433
env:
2534
LINEAR_API_KEY: ${{ secrets.linear-api-key }}
26-
LINEAR_LABEL_ID: ${{ secrets.linear-label-id }}
27-
LINEAR_DOCS_TEAM_ID: ${{ secrets.linear-docs-team-id }}
35+
ISSUE_LABEL_ID: ${{ secrets.issue-label-id }}
36+
ISSUE_TEAM_ID: ${{ secrets.issue-team-id }}
37+
ISSUE_PREFIX: ${{ inputs.issue-prefix }}
2838
PR_TITLE: ${{ github.event.pull_request.title }}
2939
PR_URL: ${{ github.event.pull_request.html_url }}
3040
run: |
31-
desc=
3241
PAYLOAD=$(jq -n \
33-
--arg t "DOC: $PR_TITLE" \
42+
--arg t "$ISSUE_PREFIX: $PR_TITLE" \
3443
--arg d "PR: $PR_URL" \
35-
--arg id "$LINEAR_DOCS_TEAM_ID" \
36-
--arg l "$LINEAR_LABEL_ID" \
44+
--arg id "$ISSUE_TEAM_ID" \
45+
--arg l "$ISSUE_LABEL_ID" \
3746
'{
3847
query: "mutation($t:String!,$d:String!,$id:String!,$l:[String!]){issueCreate(input:{title:$t,description:$d,teamId:$id,labelIds:$l}){success issue{identifier url}}}",
3948
variables: { t: $t, d: $d, id: $id, l: [$l] }

0 commit comments

Comments
 (0)