Skip to content

Commit

Permalink
ci: 🚀 Setup github actions to run build when opening PR
Browse files Browse the repository at this point in the history
  • Loading branch information
ltsaiete committed Nov 4, 2023
1 parent e04be69 commit 00df3d4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build_on_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build package on PR opening

on:
pull_request:
branches:
- develop
- master
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Run pre-commit script
run: npm run pre-commit
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"test": "mocha",
"lint": "eslint --fix src/*.js",
"prettier": "prettier -w src/*",
"build": "rm dist/* && babel src -d dist --out-file-extension .cjs && find ./dist -type f -exec sed -i 's/.js/.cjs/g' {} \\;"
"build": "rm dist/* && babel src -d dist --out-file-extension .cjs && find ./dist -type f -exec sed -i 's/.js/.cjs/g' {} \\;",
"pre-commit": "npm run prettier && npm run build && npm run change-file-imports && git add dist/",
"change-file-imports": "find ./dist -type f -exec sed -i 's/.js/.cjs/g' {} \\;"
},
"repository": {
"type": "git",
Expand All @@ -26,11 +28,6 @@
"bugs": {
"url": "https://github.com/paymentsds/mpesa-js-sdk/issues"
},
"husky": {
"hooks": {
"pre-commit": "npm run-script prettier && npm run-script build && git add dist/"
}
},
"homepage": "https://github.com/paymentsds/mpesa-js-sdk#readme",
"dependencies": {
"axios": "^0.27.2"
Expand Down

0 comments on commit 00df3d4

Please sign in to comment.