-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
468 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Custom Actions | ||
|
||
This directory contains custom actions built to support the workflows in this repo and encourage reusability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 'Create .env file' | ||
description: 'An action that creates an .env file from the provided environment variables' | ||
inputs: | ||
env_file_name: | ||
description: 'The env file name that is created' | ||
default: 'app.env' | ||
APP_NAME: | ||
description: 'The name of the Golang app' | ||
APP_URL: | ||
description: 'The URL of the app' | ||
SERVER_PORT: | ||
description: 'The server port' | ||
DB_NAME: | ||
description: 'The name of the database' | ||
USERNAME: | ||
description: 'The database username' | ||
REDIS_PORT: | ||
description: 'The port for Redis' | ||
REDIS_HOST: | ||
description: 'The host for Redis' | ||
REDIS_DB: | ||
description: 'The Redis database number' | ||
GOOGLE_CLIENT_ID: | ||
description: 'The Google client ID' | ||
GOOGLE_CLIENT_SECRET: | ||
description: 'The Google client secret' | ||
FACEBOOK_CLIENT_ID: | ||
description: 'The Facebook client ID' | ||
FACEBOOK_CLIENT_SECRET: | ||
description: 'The Facebook client secret' | ||
SESSION_SECRET: | ||
description: 'The session secret key' | ||
MAIL_SERVER: | ||
description: 'The mail server' | ||
MAIL_USERNAME: | ||
description: 'The mail server username' | ||
MAIL_PASSWORD: | ||
description: 'The mail server password' | ||
MAIL_PORT: | ||
description: 'The mail server port' | ||
MIGRATE: | ||
description: 'Flag indicating whether to run migrations' | ||
|
||
outputs: | ||
env_file: | ||
description: 'The created .env file' | ||
|
||
runs: | ||
using: 'node20' | ||
main: 'index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
const { writeFile } = require('node:fs/promises'); | ||
|
||
try { | ||
const envFileName = core.getInput('env_file_name') || "app.env" | ||
|
||
const secrets = [ | ||
"APP_NAME", | ||
"APP_URL", | ||
"SERVER_PORT", | ||
"DB_NAME", | ||
"USERNAME", | ||
"REDIS_PORT", | ||
"REDIS_HOST", | ||
"REDIS_DB", | ||
"GOOGLE_CLIENT_ID", | ||
"GOOGLE_CLIENT_SECRET", | ||
"FACEBOOK_CLIENT_ID", | ||
"FACEBOOK_CLIENT_SECRET", | ||
"SESSION_SECRET", | ||
"MAIL_SERVER", | ||
"MAIL_USERNAME", | ||
"MAIL_PASSWORD", | ||
"MAIL_PORT", | ||
"MIGRATE" | ||
]; | ||
|
||
|
||
let envString = "" | ||
|
||
for (let secret of secrets){ | ||
const value = core.getInput(secret) | ||
envString += `${secret}=${value}\n` | ||
} | ||
|
||
const envFile = await writeFile(envFileName, envString, { encoding: 'utf-8' }) | ||
|
||
core.setOutput("env_file", envFile); | ||
|
||
const payload = JSON.stringify(github.context.payload, undefined, 2) | ||
console.log(`The event payload: ${payload}`); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.