Skip to content

Commit

Permalink
test deployments locally
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebTheWizard committed Dec 25, 2023
1 parent ab0d4ac commit 90e3cd4
Show file tree
Hide file tree
Showing 31 changed files with 38,834 additions and 735 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/entry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,3 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
148 changes: 146 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,147 @@


# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.idea/
node_modules
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

# End of https://www.toptal.com/developers/gitignore/api/node

.env.secrets
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ embed: {
## Testing / Contributing.
We suggest everyone uses a tool like https://github.com/nektos/act to test GitHub actions locally. This is the tool I use so the directory structure will reflect that. If the following command does not pass, I will not accept your PR.
Tests use https://github.com/nektos/act to simulate GitHub Actions locally.
1. install act see https://github.com/nektos/act for instructions.
1. `cp .env.example .env` paste discord commit url into .env
1. `cp .env.example .env.secrets` paste discord commit url into .env.secrets
1. make sure the following command passes.
```
act -W tests/workflows -e tests/push.json
./tests/deploy/test.sh
```
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ inputs:

runs:
using: "node16"
main: "discord-commits/index.mjs"
main: "dist/index.js"
2 changes: 2 additions & 0 deletions build-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
ncc build discord-commits/index.js --license licenses.txt
6 changes: 3 additions & 3 deletions discord-commits/api.mjs → discord-commits/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import st from "stjs";

export async function loadTemplate(name) {
try {
return (await import(`./templates/${name}.mjs`)).default
return (await import(`./templates/${name}.js`)).default
} catch (err) {
return (await import(`./templates/plain.mjs`)).default
return (await import(`./templates/plain.js`)).default
}
}

Expand Down Expand Up @@ -33,4 +33,4 @@ export function createCommit(commit) {

export function parseTemplate(data, template) {
return st.select(data).transformWith(template).root()
}
}
File renamed without changes.
4 changes: 2 additions & 2 deletions discord-commits/index.mjs → discord-commits/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import core from "@actions/core";
import github from "@actions/github";
import fetch from "node-fetch";
import { createCommit, loadTemplate, parseTemplate, stringOrFalse, stringToBoolean } from "./api.mjs";
import defaultPayload from "./defaults/payload-commits.mjs"
import { createCommit, loadTemplate, parseTemplate, stringOrFalse, stringToBoolean } from "./api.js";
import defaultPayload from "./defaults/payload-commits.js"

const templateName = core.getInput("template") || "plain";
const template = await loadTemplate(templateName)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions dist/302.index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const id = 302;
export const ids = [302];
export const modules = {

/***/ 7302:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/**
* Returns a message and no embeds
*/

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
message: "Successful commit to **{{ github.context.payload.repository.owner.name }}/{{ github.context.payload.repository.name}}**",
embed: false,
extras: [{
title: "View All Changes",
url: "{{ github.context.payload.compare }}"
}]
});

/***/ })

};
Loading

0 comments on commit 90e3cd4

Please sign in to comment.