Skip to content

update to use team key #1

update to use team key

update to use team key #1

name: Create Documentation Linear Issue

Check failure on line 1 in .github/workflows/create-docs-issue.yml

View workflow run for this annotation

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

Invalid workflow file

(Line: 7, Col: 9): Required property is missing: type
on:
workflow_call:
inputs:
team-key:
required: true
description: The key of the team in Linear e.g. ENG, DEV etc.
secrets:
linear-api-key:
required: true
description: An API key to use to create an issue for documentation.
linear-label-id:
required: true
description: The ID of the label to be added to the issue.
jobs:
create-issue:
if: >
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'docs: needed')
runs-on: ubuntu-latest
steps:
- name: Create Linear Issue
env:
LINEAR_API_KEY: ${{ secrets.linear-api-key }}
LINEAR_LABEL_ID: ${{ secrets.linear-label-id }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
PAYLOAD=$(jq -n \
--arg t "${{ inputs.team-key }}: $PR_TITLE" \
--arg d "PR: $PR_URL\n\n$PR_BODY" \
--arg id "${{ inputs.team-key }}" \
--arg l "$LINEAR_LABEL_ID" \
'{
query: "mutation($t:String!,$d:String!,$id:String!,$l:[String!]){issueCreate(input:{title:$t,description:$d,teamId:$id,labelIds:$l}){success issue{identifier url}}}",
variables: { t: $t, d: $d, id: $id, l: [$l] }
}')
RESPONSE=$(curl -s -X POST https://api.linear.app/graphql \
-H "Content-Type: application/json" \
-H "Authorization: $LINEAR_API_KEY" \
-d "$PAYLOAD")
echo "$RESPONSE" | jq .