-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
94 lines (89 loc) · 3.85 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: 'Todoist: Create Task'
author: 'Mickaël Allonneau'
description: 'Create a task in Todoist'
branding:
color: 'red'
icon: 'check-circle'
# Inputs' descriptions are taken from the official Todoist API documentation: https://developer.todoist.com/rest/v2/#create-a-new-task
inputs:
task-name:
description: "Task content [or name]. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in [Todoist's] Help Center."
required: true
todoist-api-token:
description: 'The Todoist API token of the account to create the task in.'
required: true
task-assignee-id:
description: 'The responsible user ID (only applies to shared tasks).'
required: false
task-description:
description: "A description for the task. This value may contain markdown-formatted text and hyperlinks. Details on markdown support can be found in the Text Formatting article in [Todoist's] Help Center."
required: false
task-due-date:
description: "Specific date in `YYYY-MM-DD` format relative to user's timezone."
required: false
task-due-datetime:
description: 'Specific date and time in RFC3339 format in UTC.'
required: false
task-due-lang:
description: '2-letter code specifying language in case `due_string` is not written in English.'
required: false
task-due-string:
description: 'Human defined task due date (ex.: "next Monday", "Tomorrow"). Value is set using local (not UTC) time.'
required: false
task-duration:
description: 'A positive (greater than zero) integer for the amount of `duration_unit` the task will take. If specified, you **must** define a `duration_unit`.'
required: false
task-duration-unit:
description: 'The unit of time that the `duration` field above represents. Must be either `minute` or `day`. If specified, `duration` **must** be defined as well.'
required: false
task-labels:
description: "The task's labels (a list of names that may represent either personal or shared labels)."
required: false
task-order:
description: 'Non-zero integer value used by clients to sort tasks under the same parent.'
required: false
task-parent-id:
description: 'Parent task ID.'
required: false
task-priority:
description: 'Task priority from 1 (normal) to 4 (urgent).'
required: false
task-project-id:
description: "Task project ID. If not set, task is put to user's Inbox."
required: false
task-section-id:
description: 'ID of section to put task into.'
required: false
runs:
using: 'composite'
steps:
- name: Create cURL request's JSON body
env:
TASK_ASSIGNEE_ID: ${{ inputs.task-assignee-id }}
TASK_DESCRIPTION: ${{ inputs.task-description }}
TASK_DUE_DATE: ${{ inputs.task-due-date }}
TASK_DUE_DATETIME: ${{ inputs.task-due-datetime }}
TASK_DUE_LANG: ${{ inputs.task-due-lang }}
TASK_DUE_STRING: ${{ inputs.task-due-string }}
TASK_DURATION: ${{ inputs.task-duration }}
TASK_DURATION_UNIT: ${{ inputs.task-duration-unit }}
TASK_LABELS: ${{ inputs.task-labels }}
TASK_NAME: ${{ inputs.task-name }}
TASK_ORDER: ${{ inputs.task-order }}
TASK_PARENT_ID: ${{ inputs.task-parent-id }}
TASK_PRIORITY: ${{ inputs.task-priority }}
TASK_PROJECT_ID: ${{ inputs.task-project-id }}
TASK_SECTION_ID: ${{ inputs.task-section-id }}
shell: bash
run: $GITHUB_ACTION_PATH/create-curl-request-json-body.sh
- name: Run cURL command
env:
TODOIST_API_TOKEN: ${{ inputs.todoist-api-token }}
shell: bash
run: >
curl 'https://api.todoist.com/rest/v2/tasks'
-X POST
-d @curl-request-body.json
-H "Authorization: Bearer $TODOIST_API_TOKEN"
-H 'Content-Type: application/json'
-H "X-Request-Id: $(uuidgen)"