Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jivings committed Mar 14, 2023
0 parents commit 53cbfc4
Show file tree
Hide file tree
Showing 865 changed files with 258,589 additions and 0 deletions.
16 changes: 16 additions & 0 deletions get-droplet-ips.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Get Droplet IPs'
description: 'Get the IPs to deploy to using tags'
inputs:
digital-ocean-key:
description: 'The API KEY for DO'
required: true
tags:
description: The tags of the servers
required: true

outputs:
server_ips: # id of output
description: 'The IPs that match the provided tags'
runs:
using: 'node16'
main: 'index.js'
29 changes: 29 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const core = require('@actions/core');
const digitalocean = require('digitalocean');

try {
// `who-to-greet` input defined in action metadata file
const apiKey = core.getInput('digital-ocean-key');
const tags = core.getInput('tags');
const client = digitalocean.client(apiKey);

console.log(`Fetching droplets for tags ${JSON.stringify(tags)}`);

client.droplets
.list()
.then((drops) => {
return drops.filter((d) => d.tags.some((dtag) => tags.includes(dtag)));
})
.then((drops) => {
console.log(`Found ${drops.length} matching droplets`);
return drops.map((d) => d[0].networks.v4[0].ip_address);
})
.then((ips) => {
core.setOutput('server_ips', ips || []);
})
.catch((err) => {
core.setFailed(err.message);
});
} catch (error) {
core.setFailed(error.message);
}
1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-conv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-sign

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-verify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions node_modules/.yarn-integrity

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/@actions/core/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 53cbfc4

Please sign in to comment.