@girishcodealchemy/backstage-customhttprequest-plugin v0.6.0
@girishcodealchemy/backstage-customhttprequest-plugin
The customhttprequest module for @backstage/plugin-scaffolder-backend This plugin was created through the Backstage CLI
Overview
This Backstage plugin provides a custom http:request action for the scaffolder backend,
enabling users to make HTTP requests to APIs or services as part of a Backstage scaffolder template.
With this action, you can interact with external services, update configurations, or
manage permissions in an automated workflow.
Installation
1. Install the plugin into your Backstage project:
yarn workspace backend add @girishcodealchemy/backstage-customhttprequest-plugin2. Register the action in your index.ts file in the Backstage backend (usually found at packages/backend/src/index.ts)
backend.add(import('@girishcodealchemy/backstage-customhttprequest-plugin'));Usage
The custom http:request action allows for making HTTP requests within a template. This is particularly useful for scenarios such as setting up permissions, triggering workflows, or updating settings in a target system. Here’s how to use the custom action in a Backstage template YAML file to set permissions on a GitHub repository workflow:
- id: set-permissions
name: Set Workflow Permissions
action: http:request
input:
method: PUT
url: https://api.github.com/repos/${{ (parameters.repoUrl | parseRepoUrl)["owner"] }}/${{ (parameters.repoUrl | parseRepoUrl)["repo"] }}/actions/permissions/workflow
headers:
Authorization: Bearer ${{ secrets.GITHUB_PAT_TOKEN }}
Accept: application/vnd.github+json
body:
default_workflow_permissions: write