GithubHelp home page GithubHelp logo

isabella232 / actions-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from probot/adapter-github-actions

0.0 0.0 0.0 457 KB

:electric_plug: An adapter that takes a Probot app and makes it compatible with GitHub Actions

License: ISC License

JavaScript 100.00%

actions-adapter's Introduction

๐Ÿ”Œ probot-actions-adapter

An adapter that takes a Probot app and makes it compatible with GitHub Actions

GitHub Actions status

Contents

Installation

npm i -S probot-actions-adapter

Usage

  1. Add an action.js to your Probot project, like the one shown below
  2. Add an action.yml to your Probot project, like the one shown below
  3. Vendor in your node_modules, as recommended by the official Actions documentation
  4. Optional, but recommended, update your project's README with an example workflow showing how to consume your action

Example action.js

// Require the adapter
const runProbot = require('probot-actions-adapter');

// Require your Probot app's entrypoint, usually this is just index.js
const app = require('./index');

// Adapt the Probot app for Actions
// This also acts as the main entrypoint for the Action
runProbot(app);

Example action.yml

name: 'Probot app name'
description: 'Probot app description.'
runs:
  using: 'node12'
  main: 'action.js'

See the documentation for action.yml syntax details.

Authentication

Authentication is via the GITHUB_TOKEN secret automatically provided by GitHub, which should be exposed as an environment variable, GITHUB_TOKEN. This can be achieved by including the appropriate env, jobs.<job_id>.env, or jobs.<job_id>.steps.env value in your workflow file.

Example via jobs.<job_id>.steps.env

Include the following in your workflow file, when calling your Probot action:

...
steps:
  - name: My probot action
    ...
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...

Caveats

This adapter is designed to work well with Probot apps that are essentially stateless webhook handlers.

A few other limitations exist:

  1. The adapter will only work for Probot apps that receive webhook events that Actions also receives: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
  2. The adapter will only work for Probot apps with a permissions set that is less than, or equivalent to the permission set attached to the GITHUB_TOKEN: https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#token-permissions

If that's you, then great! ๐Ÿš€

actions-adapter's People

Contributors

swinton avatar gr2m avatar dependabot[bot] avatar kengotoda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.