npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mdude2314/backstage-plugin-scaffolder-git-actions

v1.1.1

Published

This is a `git` actions plugin for the `scaffolder-backend` in Backstage.

Downloads

3,924

Readme

backstage-plugin-scaffolder-git-actions package

This is a git actions plugin for the scaffolder-backend in Backstage.

This contains a collection of actions for using with git:

  • git
  • git:clone

Prerequisites

  • Git must be installed in the environment your Backstage instance is running in

Getting started

In the root directory of your Backstage project:

yarn add --cwd packages/backend @mdude2314/backstage-plugin-scaffolder-git-actions

Add the actions you'd like to the scaffolder:

// packages/backend/src/plugins/scaffolder.ts

import { gitCloneAction, gitAction } from "@mdude2314/backstage-plugin-scaffolder-git-actions";
import { ScmIntegrations } from '@backstage/integration';
import { createBuiltinActions, createRouter } from '@backstage/plugin-scaffolder-backend';

...

const integrations = ScmIntegrations.fromConfig(env.config);
const builtInActions = createBuiltinActions({
  catalogClient,
  integrations,
  config: env.config,
  reader: env.reader
});

const actions = [
  gitAction(),
  gitCloneAction(),
  ...builtInActions
];

return await createRouter({
  logger: env.logger,
  config: env.config,
  database: env.database,
  reader: env.reader,
  catalogClient,
  actions
});

Example of using the generic git action

---
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: clone-demo
  title: My custom git clone action
  description: scaffolder action to clone to the workspace directory
spec:
  owner: mdude2314
  type: service

  parameters:
    - title: Generic git
      properties:
        repoUrl:
          title: Command
          type: string
          description: Git command to run
        workingDirectory:
          title: Working Directory
          type: string
          description: The working directory within the scaffolder workspace to run the command
        args:
          title: Args
          type: array
          description: Arguments to pass to the clone command

  steps:
    - id: git
      name: git
      action: git
      input:
        command: ${{ parameters.command }} # ex: 'commit' - will make the scaffolder run the `git commit` command
        workingDirectory: ${{ parameters.workingDirectory }} # ex: './my-working-directory' - will execute the command in the specified directory relative to the scaffolder workspace
        args: ${{ parameters.args }} # ex: ['-m', 'My commit message'] - will add '-m My commit message' to the arguments passed to the git command

Example of using the clone action

---
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: clone-demo
  title: My custom git clone action
  description: scaffolder action to clone to the workspace directory
spec:
  owner: mdude2314
  type: service

  parameters:
    - title: Clone
      properties:
        repoUrl:
          title: Path
          type: string
          description: URL to clone
        args:
          title: Args
          type: array
          description: Arguments to pass to the clone command

  steps:
    - id: clone
      name: Clone
      action: git:clone
      input:
        repoUrl: ${{ parameters.repoUrl }}
        args: ${{ parameters.args }}