Skip to content

Commit 9cc4d5c

Browse files
initial commit
0 parents  commit 9cc4d5c

File tree

7 files changed

+172
-0
lines changed

7 files changed

+172
-0
lines changed

.github/workflows/example.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Example Workflow
2+
3+
on: [ push ]
4+
5+
jobs:
6+
example-job:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
12+
- name: Setup Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: '22'
16+
17+
- name: Install dependencies
18+
run: npm install
19+
20+
- name: Run input script
21+
run: node input.js
22+
env:
23+
APPLICATIONNAME: 'MyApp'
24+
ENVIRONMENT: 'Production'
25+
CONTAINERREGISTRYNAME: 'mycontainerregistry'
26+
RGNAME: 'myresourcegroup'
27+
SUBSCRIPTIONNAME: 'mysubscription'
28+
ENABLEREPLICATION: 'true'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.env

data.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"applicationName": "MyApp",
3+
"environment": "Production",
4+
"containerRegistryName": "mycontainerregistry",
5+
"rgName": "myresourcegroup",
6+
"subscriptionName": "mysubscription",
7+
"enableReplication": "true"
8+
}

generate.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const fs = require('fs');
2+
require('dotenv').config();
3+
4+
const data = {
5+
applicationName: process.env.APPLICATIONNAME,
6+
environment: process.env.ENVIRONMENT,
7+
containerRegistryName: process.env.CONTAINERREGISTRYNAME,
8+
rgName: process.env.RGNAME,
9+
subscriptionName: process.env.SUBSCRIPTIONNAME,
10+
enableReplication: process.env.ENABLEREPLICATION
11+
};
12+
13+
fs.writeFileSync('data.json', JSON.stringify(data, null, 2), 'utf-8');
14+
console.log('Data written to data.json');

input.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const core = require('@actions/core');
2+
const { execSync } = require('child_process');
3+
require('dotenv').config();
4+
5+
try {
6+
7+
execSync('node generate.js', { stdio: 'inherit' });
8+
9+
const applicationName = process.env.APPLICATIONNAME || core.getInput('applicationname');
10+
const environment = process.env.ENVIRONMENT || core.getInput('environment');
11+
const containerRegistryName = process.env.CONTAINERREGISTRYNAME || core.getInput('containerregistryname');
12+
const rgName = process.env.RGNAME || core.getInput('rgname');
13+
const subscriptionName = process.env.SUBSCRIPTIONNAME || core.getInput('subscriptionname');
14+
const enableReplication = process.env.ENABLEREPLICATION || core.getInput('enablereplication');
15+
16+
console.log(`Application Name: ${applicationName}`);
17+
console.log(`Environment: ${environment}`);
18+
console.log(`Container Registry Name: ${containerRegistryName}`);
19+
console.log(`Resource Group Name: ${rgName}`);
20+
console.log(`Subscription Name: ${subscriptionName}`);
21+
console.log(`Enable Replication: ${enableReplication}`);
22+
} catch (error) {
23+
core.setFailed(`Action failed with error: ${error.message}`);
24+
}

package-lock.json

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"@actions/core": "^1.11.1",
4+
"dotenv": "^16.4.7"
5+
}
6+
}

0 commit comments

Comments
 (0)