Skip to main content

This script automates the process of setting up GitHub Actions workflows for Postman collections. It supports both GitHub repository integration and local workflow setup, allowing for flexible usage in various scenarios.

Project description

PostmanxGithub Action Automatic Sync

This script automates the process of setting up GitHub Actions workflows for Postman collections. It supports both GitHub repository integration and local workflow setup, allowing for flexible usage in various scenarios.

Features

  • Export Postman collections using a UID or from a local file
  • Add Postman collections to GitHub repositories (new or existing)
  • Create or update GitHub Actions workflows
  • Set up workflows locally without GitHub interaction
  • Use custom YAML templates for GitHub Actions workflows
  • Support for both new and existing repositories

Prerequisites

  • Python 3.x
  • GitHub personal access token (for GitHub repository operations)
  • Postman API key (if exporting collection by UID)
  • requests Python package

Installation

  1. Clone this repository:

    git clone https://github.com/BlazinArtemis/project-work.git
    cd project-work
    
  2. Install the required Python package:

    pip install requests
    

Usage

The script can be used in several ways:

  1. Standard GitHub Repository Setup:

    python main.py
    

    This guides you through setting up a GitHub Actions workflow for a Postman collection in a GitHub repository (new or existing).

  2. Local Workflow Setup:

    python main.py --local
    

    This sets up the workflow files locally without interacting with GitHub.

  3. GitHub Repository Setup with Custom Template:

    python main.py --template path/to/template.yml
    

    This sets up a GitHub Actions workflow using a custom YAML template.

  4. Local Workflow Setup with Custom Template:

    python main.py --local --template path/to/template.yml
    

    This creates a local workflow setup using a custom YAML template.

For each option, you can choose between:

  • Using a Postman collection from a UID (requires Postman API key)
  • Using a Postman collection from a local JSON file

For GitHub repository options, you can choose between:

  • Using an existing GitHub repository
  • Creating a new GitHub repository

Detailed Usage Instructions

GitHub Token

The script checks for the GitHub token in the environment variable GITHUB_TOKEN. If not found, it prompts you to enter it and saves it to your environment.

To set the token manually:

export GITHUB_TOKEN=your_github_token_here

Postman API Key

For UID-based collection export, the script checks for the Postman API key in the environment variable POSTMAN_API_KEY. If not found, it prompts you to enter it.

To set the key manually:

export POSTMAN_API_KEY=your_postman_api_key_here

Workflow Process

  1. Choose between UID or file-based Postman collection.
  2. For GitHub repository setup:
    • Choose between existing or new repository.
    • For existing repos, enter the full repository name (e.g., "username/repo").
    • For new repos, enter the desired repository name.
  3. The script will generate or modify the GitHub Actions workflow YAML file.
  4. For GitHub setups, changes are committed and pushed to the repository.
  5. For local setups, files are created in the current directory.

Examples

  1. Setting up a workflow in a GitHub repository:

    python main.py
    

    Follow the prompts to choose between UID/file, existing/new repo, etc.

  2. Setting up a local workflow:

    python main.py --local
    

    This will create the necessary files in your current directory.

  3. Using a custom template for GitHub setup:

    python main.py --template my_template.yml
    

    This will use your custom template for the GitHub Actions workflow.

  4. Local setup with a custom template:

    python main.py --local --template my_template.yml
    

    This creates a local setup using your custom template.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your features or fixes.

License

This project is licensed under the MIT License.

Support

For issues, questions, or contributions, please open an issue in the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postman_github_sync-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

postman_github_sync-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file postman_github_sync-0.1.0.tar.gz.

File metadata

  • Download URL: postman_github_sync-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for postman_github_sync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2c50e5e04f4f74c71b3dc62483220a573f42211d8c4ed4fb36d5b6200fd7926d
MD5 8d5e188072d3f426d58ad4d19f1c6394
BLAKE2b-256 0ecfb76105a9b5a4da9457b6c1a56e47ea60f5152f40f436065c389516610b9a

See more details on using hashes here.

File details

Details for the file postman_github_sync-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for postman_github_sync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0efab4e05f9947fb3706a5acaa7e09193672058a0bd40ef06387d6b3cf4b44b2
MD5 4b782e960988fcb4b2e5bab7406eb84f
BLAKE2b-256 d37c4a8aef92fd1b5aead49a017fef77d7877d75620649acd3396c0622a46d2d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page