Coder Social home page Coder Social logo

Comments (4)

andrewsomething avatar andrewsomething commented on June 6, 2024 1

Hi @angristan,

Judging from your comment in digitalocean/doctl#630, I think you are looking for the doctl projects resources assign command.

That said, you can use multiple accounts with this action. Using the token provide as a required argument, a context name default is created. You can override the account by using the --access-token flag.

- name: Create Droplet in different account
  env:
    NEW_TOKEN: ${{ secrets.new_token }}
  run: doctl compute droplet create example.com --size s-1vcpu-1gb --image ubuntu-20-04-x64 --region nyc3 --access-token=$NEW_TOKEN

from action-doctl.

angristan avatar angristan commented on June 6, 2024 1

Thanks!

I ended up doing as suggested in digitalocean/doctl#630.

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 25d1ad9..09924d3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -27,9 +27,18 @@ jobs:
         token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
 
     - name: Create server
-      run: doctl compute droplet create action-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-${{ matrix.os-image }} --size s-1vcpu-1gb --image ${{ matrix.os-image }} --region lon1 --enable-ipv6 --ssh-keys be:66:76:61:a8:71:93:aa:e3:19:ba:d8:0d:d2:2d:d4
+      run: doctl compute droplet create action-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-${{ matrix.os-image }} --size s-1vcpu-1gb --image ${{ matrix.os-image }} --region lon1 --enable-ipv6 --ssh-keys be:66:76:61:a8:71:93:aa:e3:19:ba:d8:0d:d2:2d:d4 --wait
 
-    - name: Wait for server to be created
-      run: sleep 90
+    - name: Get server ID
+      run: echo ::set-output name=value::$(doctl compute droplet list -o json | jq -r '.[] | select(.name == "'action-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-${{ matrix.os-image }}'").id')
+      id: server_id
+
+    - name: Move server to dedicated project
+      run: doctl projects resources assign ${{ secrets.DIGITALOCEAN_PROJECT_ID }} --resource=do:droplet:${{ steps.server_id.outputs.value }}
+
+    - name: Wait for server to boot
+       run: sleep 90
 
     - name: Get server IP

from action-doctl.

andrewsomething avatar andrewsomething commented on June 6, 2024

Glad to see you got it all working!

from action-doctl.

angristan avatar angristan commented on June 6, 2024

By the way, thanks for action-doctl! I was pleasantly surprised when I found it. 🙂

from action-doctl.

Related Issues (20)

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.