GithubHelp home page GithubHelp logo

tchar / manage-digital-ocean-managed-database-trusted-sources-gh-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garreauarthur/manage-digital-ocean-managed-database-trusted-sources-gh-action

0.0 0.0 0.0 30 KB

Everything is in the title düd

License: MIT License

JavaScript 100.00%

manage-digital-ocean-managed-database-trusted-sources-gh-action's Introduction

manage-digital-ocean-managed-database-trusted-sources-gh-action

(this is scuffed, I am doing it in a hurry)

Github action to add or remove the IP address of your github hosted runner, to the list of the trusted sources of your digital ocean managed database. To be able to let the GH runner interact with your database.

So here's the scenario:

  • You are creating a workflow using Github actions,
  • and you are using a Digital Ocean Managed Database.
  • You are also a responsible human being, and decided to limit the access of your databases to trusted sources only.
  • But, you realize that your CI/CD workflow needs to interact with your database,
  • and because you are cheap or lazy (or both like me)
  • you don't want to set up a droplet to host your runner.
  • You just want to use Github hosted runners to run your workflow.
  • But you doubt that github runners always are the same with the same IP address
  • So you decided to use this action to add and remove the runner's IP address to the list of trusted sources of your database.

I know this name is very long and annoying, but I tried to be explicit, the worst is that I kind of failed.

Input variables

See action.yml for more information.

  • action: whether you want to "add" or "remove" the IP address to the trusted sources
  • database_id: The ID of your managed database (in UUID format). You can find it with doctl databases list (cf. Digital Ocean Doc)
  • digitalocean_token: A personal access token to digital ocean. Find out here to know how to create one.

Best practice: Use GitHub Secrets to store the database_id and digitalocean_token.

How to use it ?

In your workflow:

# Step 1, add the IP address
- name: Add IP address to trusted source (managed database)
  uses: GarreauArthur/manage-digital-ocean-managed-database-trusted-sources-gh-action@main
  with:
    action: "add"
    database_id: ${{ secrets.DATABASE_ID }}
    digitalocean_token: ${{ secrets.DIGITALOCEAN_TOKEN }}

# Step 2, do whatever you need to do with you database
- name: Do something with you database
  run: echo "Migrating database"

# Step 3, remove the IP address
- name: Remove IP address to trusted source (managed database)
  uses: GarreauArthur/manage-digital-ocean-managed-database-trusted-sources-gh-action@main
  with:
    action: "remove"
    database_id: ${{ secrets.DATABASE_ID }}
    digitalocean_token: ${{ secrets.DIGITALOCEAN_TOKEN }}

Info for devs

  1. Clone this repo
  2. npm i
  3. Do the thing (code)
  4. Build with npm build
  5. commit & push
  6. create pull request

or

  1. Fork the project ^^

TODO list

Probably never going to do this.

  • Set up workflow to automatically build the action
  • Let users the ability to choose the IP address they want to add/remove
  • Let users the ability to choose the rule they want to add.
  • finish the todo list

manage-digital-ocean-managed-database-trusted-sources-gh-action's People

Contributors

garreauarthur avatar tchar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.