open-index/open-npm huggingface dataset:
npm package: @girishcodealchemy/backstage-customhttprequest-plugin
Description: The customhttprequest module for @backstage/plugin-scaffolder-backend
Latest version: 0.6.0

# @girishcodealchemy/backstage-customhttprequest-plugin

 The customhttprequest module for [@backstage/plugin-scaffolder-backend](https://www.npmjs.com/package/@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:
```bash
yarn workspace backend add @girishcodealchemy/backstage-customhttprequest-plugin
```
### 2. Register the action in your index.ts file in the Backstage backend (usually found at `packages/backend/src/index.ts`)
```typescript
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:

```yaml
- 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
```