From 46b977ec1c7d55a2435b608727069b92e4ae1b6c Mon Sep 17 00:00:00 2001 From: Kevin Meinhardt Date: Fri, 24 Nov 2023 14:29:35 +0000 Subject: [PATCH 1/2] chore(): should not work --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9fc6483..93eb8f1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,2 @@ # test-github-features -Repo to test github settings for PRs, CI, merging - -Cannot push to main. \ No newline at end of file +Repo to test github settings for PRs, CI, merging \ No newline at end of file From b84bbcd3abdae7d517f42009e05579aaf0f3cf40 Mon Sep 17 00:00:00 2001 From: Kevin Meinhardt Date: Fri, 24 Nov 2023 14:46:25 +0000 Subject: [PATCH 2/2] chore(): add build in ci --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ build.mjs | 18 ++++++++++++++++++ node_modules/.package-lock.json | 7 +++++++ package-lock.json | 13 +++++++++++++ package.json | 11 +++++++++++ 5 files changed, 70 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 build.mjs create mode 100644 node_modules/.package-lock.json create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4462ed9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: ci build +run-name: ${{ github.actor }} is learning GitHub Actions +on: + pull_request: + merge_group: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Install dependencies + run: npm i + - name: Build + run: npm run build + env: + CI_DELAY: "60000" + CI_FAIL: "" diff --git a/build.mjs b/build.mjs new file mode 100644 index 0000000..7b2e6c8 --- /dev/null +++ b/build.mjs @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +const delay = parseInt(process.env.CI_DELAY || 3_000, 10); +const shouldFail = Boolean(process.env.CI_FAIL || ''); + +console.log('config', {delay, shouldFail, raw: { delay: process.env.CI_DELAY, shouldFail: process.env.CI_FAIL}}); + +await new Promise((resolve, reject) => { + console.log(`Running build... for ${delay / 1000} seconds`); + setTimeout(() => { + if (shouldFail) { + return reject('failing.... booo'); + } + resolve(true); + }, delay); +}); + +console.log("Built!"); \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..4ab1e19 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,7 @@ +{ + "name": "test-github-features", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f1cef0c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "test-github-features", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "test-github-features", + "version": "1.0.0", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3854508 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "test-github-features", + "version": "1.0.0", + "description": "Repo to test github settings for PRs, CI, merging", + "main": "index.js", + "scripts": { + "build": "node ./build.mjs" + }, + "author": "", + "license": "ISC" +}