From fc6171d329690fda8fef15ac8a3d3f11f6a06e8f Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Wed, 31 Jul 2024 02:05:20 -0400 Subject: [PATCH] Init --- .github/CODEOWNERS | 1 + .github/workflows/validate.yml | 18 ++++++++++++++++++ .gitignore | 1 + README.md | 18 ++++++++++++++++++ action.yml | 8 ++++++++ package.json | 27 +++++++++++++++++++++++++++ src/index.js | 17 +++++++++++++++++ 7 files changed, 90 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/validate.yml create mode 100644 .gitignore create mode 100644 action.yml create mode 100644 package.json create mode 100644 src/index.js diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..c58980f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @StephenHodgson \ No newline at end of file diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..bf00f46 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,18 @@ +name: validate +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: # Enable triggering the workflow manually from the Actions tab +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + validate: + runs-on: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + - run: echo "hello world" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/README.md b/README.md index 3874a79..9aec5e7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # github-action-js-template + A GitHub Actions template repository for JavaScript based Actions + +## How to use + +### workflow + +```yaml +steps: + - uses: RageAgainstThePixel/@v1 +``` + +### inputs + +| name | description | required | +| ---- | ----------- | -------- | +| .... | ........... | ........ | + +### outputs diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d172bae --- /dev/null +++ b/action.yml @@ -0,0 +1,8 @@ +name: +description: 'A GitHub Actions template repository for JavaScript based Actions' +# inputs: +# outputs: +runs: + using: 'node20' + main: 'dist/index.js' + #post: 'dist/index.js' diff --git a/package.json b/package.json new file mode 100644 index 0000000..8fd0855 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "", + "version": "1.0.0", + "description": "A GitHub Actions template repository for JavaScript based Actions", + "author": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com//.git" + }, + "bugs": { + "url": "https://github.com///issues" + }, + "homepage": "https://github.com//", + "main": "dist/index.js", + "keywords": [], + "dependencies": { + "@actions/core": "^1.10.1" + }, + "devDependencies": { + "@vercel/ncc": "^0.34.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "npm install && npm ci && ncc build src/index.js -o dist --source-map --license licenses.txt" + } +} \ No newline at end of file diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..e048bed --- /dev/null +++ b/src/index.js @@ -0,0 +1,17 @@ +const core = require('@actions/core'); + +const IS_POST = !!core.getState('isPost'); + +const main = async () => { + try { + if (!IS_POST) { + core.info('Hello World!'); + } else { + core.info('Hello World! (post)'); + } + } catch (error) { + core.setFailed(error); + } +} + +main();