1.1.0 • Published 5 months ago

@probot/adapter-azure-functions v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

@probot/adapter-azure-functions

Adapter to run a Probot application function in Azure Functions

Build Status

Usage

Create your Probot Application as always

// app.js
module.exports = (app) => {
  app.on("issues.opened", async (context) => {
    const params = context.issue({ body: "Hello World!" });
    await context.octokit.issues.createComment(params);
  });
};

Azure Functions v4

In your Azure function file:

// src/functions/probot.js
const { app } = require("@azure/functions");
const {
  createAzureFunctionV4,
  createProbot,
} = require("@probot/adapter-azure-functions");
const probotapp = require("../app");

app.http("probot", {
  methods: ["POST"],
  authLevel: "anonymous",
  handler: createAzureFunctionV4(probotapp, {
    probot: createProbot(),
  }),
});

Azure Functions v3

Create a folder with function.json and index.js, e.g.

// ProbotFunction/function.json
{
  "bindings": [
    {
      "authLevel": "Anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": ["post"]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ]
}

and

// ProbotFunction/index.js
const {
  createAzureFunction,
  createProbot,
} = require("@probot/adapter-azure-functions");
const app = require("../app");
module.exports = createAzureFunction(app, {
  probot: createProbot(),
});

For an example Probot App continuously deployed to Azure Functions, see https://github.com/probot/example-azure-function/#how-it-works

How it works

@probot/adapter-azure-functions exports everything that probot does plus createAzureFunction.

createAzureFunction slightly differs from Probot's built-in createNodeMiddleware, as an Azure function does receives slightly different parameters.

License

ISC

1.1.0

5 months ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago