This topic was automatically generated from Slack. You can find the original thread here.
I’m creating a workflow that will create a new issue in Linear. I want to know how can I update the “Label” and “Priority on the Linear issue.
This topic was automatically generated from Slack. You can find the original thread here.
I’m creating a workflow that will create a new issue in Linear. I want to know how can I update the “Label” and “Priority on the Linear issue.
To create a new issue in Linear and update its “Label” and “Priority”, you can follow these steps: 1. Create the Issue in Linear: First, you’ll need to create the issue in Linear using the “Create Issue” action. Here’s how you can do that: markdown ## How do I use the Create Issue action? 1. Search for the Linear (OAuth) app from the step menu 2. Select the Create Issue action 3. Connect your Linear (OAuth) account 4. Select a Team or pass a string from a previous step. 5. Select a Title or pass a string from a previous step. 6. At the bottom of the step, click Test to run the action and test the configuration.
Create Issue Action Documentation 2. Update the Issue’s Label and Priority: After creating the issue, you can use the “Update Issue” action to modify its “Label” and “Priority”. However, it’s important to note that the specific steps to update the “Label” and “Priority” are not directly outlined in the provided documentation. Typically, this would involve selecting the issue you’ve just created and then specifying the new values for “Label” and “Priority” in the action’s configuration. Since the detailed steps or fields for updating “Label” and “Priority” are not explicitly mentioned in the provided documentation, I recommend checking the Linear (OAuth) app within the Pipedream UI for these specific fields when configuring the “Update Issue” action. If these fields are available in the action’s configuration, you’ll be able to set them accordingly. ```
markdown ## How do I use the Update Issue action? 1. Search for the Linear (OAuth) app from the step menu 2. Select the Update Issue action 3. Connect your Linear (OAuth) account 4. Select a Current Team or pass a string from a previous step. 5. Select an Issue or pass a string from a previous step. 6. At the bottom of the step, click Test to run the action and test the configuration.
there’s no field to update the “Label” and “Priority”. Is there any python code that can update these fields?
To update fields such as “Label” and “Priority” using Python code in a Pipedream workflow, you would typically interact with an external API that manages these fields. Since your question doesn’t specify which service or application these fields belong to, I’ll provide a general example of how you could structure a Python code step in Pipedream to make an HTTP request to an API to update these fields. You’ll need to adjust the URL, headers, and data payload according to the specific API documentation for the service you’re working with. Please replace API_ENDPOINT
, YOUR_API_KEY
, and other placeholders with the actual values provided by the service you’re integrating with. import requests def handler(pd: "pipedream"): # Set the API endpoint URL for updating the fields url = "API_ENDPOINT" # Include your API key or token for authorization headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" } # Replace 'item_id', 'new_label', and 'new_priority' with actual field names and values data = { "item_id": "ID_OF_THE_ITEM_TO_UPDATE", "label": "new_label", "priority": "new_priority" } # Make the HTTP request to update the fields response = requests.patch(url, json=data, headers=headers) # Check if the request was successful if response.status_code == 200: print("Fields updated successfully") else: print(f"Failed to update fields: {response.text}") # Return the response for use in future steps return response.json()
This example uses the requests
library to make an HTTP PATCH request, which is commonly used for updating resources. The url
should be the endpoint provided by the API for updating items, and you’ll need to include authorization headers as required by the API. The data
dictionary should be modified to include the correct field names and values you wish to update. Remember, this is a generic example. The exact implementation details will depend on the API you’re working with. You should consult the API documentation for the service managing the “Label” and “Priority” fields for specific details on making update requests.
there’s no field to update the “Label” and “Priority”. Is there any python code that can update these fields in Linear?
To update the “Label” and “Priority” fields in Linear using Python, you can leverage the Linear GraphQL API. Below is an example Python code snippet that demonstrates how to update these fields for a specific issue. Note that you’ll need to replace YOUR_LINEAR_API_KEY
, ISSUE_ID
, LABEL_ID
, and PRIORITY_VALUE
with your actual Linear API key, the ID of the issue you want to update, the ID of the label, and the priority value, respectively. import requests def update_linear_issue_label_and_priority(api_key, issue_id, label_id, priority): url = "https://api.linear.app/graphql" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", } query = """ mutation($id: String!, $labelIds: [String!], $priority: Float) { issueUpdate(input: {id: $id, labelIds: $labelIds, priority: $priority}) { success } } """ variables = { "id": issue_id, "labelIds": [label_id], "priority": priority, } response = [requests.post](http://requests.post)(url, json={"query": query, "variables": variables}, headers=headers) return response.json() # Example usage api_key = "YOUR_LINEAR_API_KEY" issue_id = "ISSUE_ID" label_id = "LABEL_ID" # Replace with the actual label ID priority = PRIORITY_VALUE # Replace with the actual priority value (Float) result = update_linear_issue_label_and_priority(api_key, issue_id, label_id, priority) print(result)
This code uses the Linear GraphQL API to update an issue’s label and priority. Make sure to replace the placeholder values with your actual data. The priority
field expects a float value, and the labelIds
field expects a list of label IDs you want to assign to the issue. Please note that this code snippet is meant to be run in a Python environment where you have control over the execution, such as your local machine or a server. If you’re looking to integrate this functionality directly into a Pipedream workflow, you would need to use Node.js or adapt this logic to a Pipedream Python code step, keeping in mind that direct API calls in Pipedream workflows typically use the axios
library for HTTP requests