Skip to content

Commit

Permalink
Add stub of validate-inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikogs committed Oct 25, 2023
1 parent 827c356 commit 1593ef8
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/tests/validate-inputs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Test action for validate-inputs
description: |
Uses validate-inputs action for checking inputs and throws
an error when any of them is invalid.
inputs:
number:
description: Should be a number
required: true
runs:
using: 'composite'
steps:
- name: Runs validate-inputs
uses: ./validate-inputs
32 changes: 32 additions & 0 deletions .github/workflows/test-validate-inputs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Test validate-inputs action

on:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
main:
name: Test validate-inputs action
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Call action with invalid input
uses: ./.github/tests/validate-inputs
with:
number: 'aa'

- name: Call action with valid input
uses: ./.github/tests/validate-inputs
with:
number: '123'
7 changes: 7 additions & 0 deletions validate-inputs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Validate inputs
description: |
This action uses regular expressions to validate inputs
runs:
using: 'node20'
main: 'dist/index.js'
17 changes: 17 additions & 0 deletions validate-inputs/dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/******/ (() => { // webpackBootstrap
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {};
try {
console.log(process.env);

} catch (error) {
core.setFailed(error.message);
}

module.exports = __webpack_exports__;
/******/ })()
;
13 changes: 13 additions & 0 deletions validate-inputs/package-lock.json

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

12 changes: 12 additions & 0 deletions validate-inputs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "validate-inputs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
6 changes: 6 additions & 0 deletions validate-inputs/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
try {
console.log(process.env);

} catch (error) {
core.setFailed(error.message);
}

0 comments on commit 1593ef8

Please sign in to comment.