🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@flxbl-io/sfops-migrator

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flxbl-io/sfops-migrator

Upgrade to revised issueops

latest
npmnpm
Version
1.2.1
Version published
Maintainers
0
Created
Source

SFOPS Migrator

The SFOPS Migrator is a Node.js script that automates the migration of GitHub repository variables from an old format to a new format. It fetches issue details, creates new variables based on the old variables, and updates the repository with the migrated variables.

Prerequisites

  • Node.js (version 12 or above)
  • GitHub access token with appropriate permissions to read issues and manage repository variables
  • Repository owner and name

Installation

You can install the SFOPS Migrator script globally using npm:

npm install -g sfops-migrator

Usage

To run the SFOPS Migrator script, use the following command:

sfops-migrator OWNER REPO YOUR_GITHUB_ACCESS_TOKEN

Replace the following placeholders:

  • YOUR_GITHUB_ACCESS_TOKEN: Your GitHub access token with appropriate permissions.
  • OWNER: The owner of the repository.
  • REPO: The name of the repository.

Example:

sfops-migrator my-organization my-repo abc123def456

How It Works

The SFOPS Migrator script performs the following steps:

  • Reads the GitHub access token, repository owner, and repository name from the command-line arguments.
  • Fetches the existing repository variables using the GitHub API.
  • For each variable ending with "_DEVSBX":
    • Parses the old variable value from JSON.
    • Fetches the issue details associated with the old variable using the issue number.
    • Extracts the source sandbox, days to keep, and user email from the issue body using regular expressions.
    • Creates a new variable object based on the old variable and the extracted details.
    • Checks if a variable with the upgraded name already exists in the repository.
    • If the upgraded variable doesn't exist, creates a new variable with the upgraded name and value.
    • If the upgraded variable already exists, skips the creation and logs a message.
  • Logs the progress and status of the migration process using console logs with emojis.

Console Output

The script provides informative console logs to track the progress and status of the migration process. The console logs include:

  • 🚀 Starting SFOPS Migration for the specified owner and repo
  • ⚙️ Upgrading variable: [variable name]
  • 📝 Issue #[issue number]: [issue title]
  • âś… Fetched issue details for issue #[issue number]
  • ⏭️ Variable [variable name] already exists. Skipping...
  • ✨ Created new variable: [variable name]
  • 🎉 SFOPS Migration completed successfully!

Error Handling

The script includes basic error handling:

  • If the GitHub access token, repository owner, or repository name is not provided as command-line arguments, an error message is logged, and the script exits with a non-zero status code.
  • If an error occurs during the API requests or variable creation, the error is thrown and logged.

FAQs

Package last updated on 24 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts