flow-server-plugin-github

1.0.0 • Public • Published

Flow Server Plugin: GitHub

A GitHub API integration plugin for the Flow Server Framework.

Features

  • Create GitHub repositories
  • Get repository information
  • List repositories for authenticated user
  • Update repository settings
  • Delete repositories
  • Get user information

Installation

# Install the plugin
npm install flow-server-plugin-github

Configuration

Add the following configuration to your Flow Server config:

{
  "plugins": {
    "github": {
      "token": "your_github_personal_access_token",
      "username": "your_github_username"
    }
  }
}

You can also use environment variables:

  • GITHUB_TOKEN: Your GitHub personal access token
  • GITHUB_USERNAME: Your GitHub username

Usage

Creating a Repository

const flow = require('flow-server');
const githubPlugin = require('flow-server-plugin-github');

// Register the plugin
flow.use(githubPlugin());

// Create a repository
const repository = await flow.services.get('github.repository').create({
  name: 'my-new-repo',
  description: 'A new repository created with Flow Server',
  private: true,
  autoInit: true,
  gitignoreTemplate: 'Node',
  licenseTemplate: 'mit'
});

console.log(`Repository created: ${repository.html_url}`);

Listing Repositories

const repositories = await flow.services.get('github.repository').list({
  type: 'all',
  perPage: 10,
  page: 1
});

repositories.forEach(repo => {
  console.log(`${repo.name}: ${repo.html_url}`);
});

Getting Repository Information

const repository = await flow.services.get('github.repository').get({
  owner: 'username',
  repo: 'repo-name'
});

console.log(repository);

Updating a Repository

const updatedRepository = await flow.services.get('github.repository').update({
  owner: 'username',
  repo: 'repo-name',
  name: 'new-repo-name',
  description: 'Updated description',
  private: false
});

console.log(`Repository updated: ${updatedRepository.html_url}`);

Deleting a Repository

await flow.services.get('github.repository').delete({
  owner: 'username',
  repo: 'repo-name'
});

console.log('Repository deleted');

Getting User Information

const user = await flow.services.get('github.user').get({
  username: 'github-username'
});

console.log(user);

Getting Authenticated User Information

const authenticatedUser = await flow.services.get('github.user').getAuthenticated();

console.log(authenticatedUser);

Required Permissions

To use this plugin, your GitHub token needs the following permissions:

  • repo - Full control of private repositories
  • delete_repo - Delete repositories (if you want to use the delete functionality)

License

MIT

Package Sidebar

Install

npm i flow-server-plugin-github

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

23.5 kB

Total Files

6

Last publish

Collaborators

  • xavdp