This Node.js Express server acts as a backend for a GitHub App. It receives webhook events for pull requests and creates or completes tasks in Microsoft To Do using the Microsoft Graph API.
- Receives GitHub webhook events for pull requests (
opened
,closed
) - Creates a new To Do task when a PR is opened (task name = PR title, link = PR URL)
- Marks the corresponding To Do task as completed when a PR is closed
- Basic logging and error handling
-
Clone the repository
git clone <your-repo-url> cd prxtodo
-
Install dependencies
npm install express body-parser axios dotenv
-
Create a
.env
file in the project root:GRAPH_API_TOKEN=your_microsoft_graph_api_token TODO_LIST_ID=your_todo_list_id PORT=3000 # optional, default is 3000
GRAPH_API_TOKEN
: OAuth 2.0 Bearer token for Microsoft Graph API with permissions to manage To Do tasks.TODO_LIST_ID
: The ID of the Microsoft To Do list where tasks will be created/completed.PORT
: (Optional) Port for the Express server (default: 3000).
-
Start the server
node server.js
-
Configure your GitHub App/Webhook
- Set the webhook URL to
http://<your-server-domain>:<port>/webhook
- Select the
pull_request
event
- Set the webhook URL to
-
On PR opened: A new To Do task is created with the PR title and link. On PR closed: The corresponding task is marked as completed.
- Register an Azure AD application at https://portal.azure.com > Azure Active Directory > App registrations.
- Add API permissions:
Tasks.ReadWrite
for Microsoft To Do. - Grant admin consent for the permissions.
- Use OAuth 2.0 to obtain an access token for the app/user. You can use tools like Microsoft Graph Explorer or your own OAuth flow.
- Set the token as
GRAPH_API_TOKEN
in your.env
file.
- Use Microsoft Graph API to list your To Do lists:
curl -H "Authorization: Bearer <GRAPH_API_TOKEN>" \ "https://graph.microsoft.com/v1.0/me/todo/lists"
- Find the
id
of the list you want to use and set it asTODO_LIST_ID
in your.env
file.
GRAPH_API_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOi...
TODO_LIST_ID=AAMkAGVmM2...
PORT=3000
MIT