Skip to content

Commit

Permalink
feat: merging auto detector
Browse files Browse the repository at this point in the history
  • Loading branch information
SudharakaP committed Dec 10, 2023
1 parent e5b485c commit b95c945
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add-to-cart.mjs filter=git-crypt diff=git-crypt
*.mjs filter=git-crypt diff=git-crypt
helpers/** filter=git-crypt diff=git-crypt
54 changes: 54 additions & 0 deletions .github/workflows/check-for-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Auto Detect Changes

env:
USERNAMES: ${{ secrets.USERNAMES }}
PASSWORDS: ${{ secrets.PASSWORDS }}
SENDING_EMAILS: ${{ secrets.SENDING_EMAILS }}
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}
LOGINS: ${{ vars.LOGINS }}
SIGN_IN_URL: ${{ vars.SIGN_IN_URL }}
WISH_LIST_URL: ${{ vars.WISH_LIST_URL }}

# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Triggers the workflow through a webhook event
repository_dispatch:
types: [check-for-changes]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-for-changes:
strategy:
fail-fast: false
matrix:
login: ${{ fromJson(vars.LOGINS) }}

# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Setup Node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- name: Install dependencies
run: npm ci --prefer-offline --no-audit

- uses: amplium/git-crypt-action@master
with:
key_encoded: ${{ secrets.DECRYPTION_SECRET }}

# Runs Puppeteer
- name: Run Puppeteer
run: export LOGIN="${{ matrix.login }}" && node check-for-changes.mjs
Binary file modified add-to-cart.mjs
Binary file not shown.
Binary file added check-for-changes.mjs
Binary file not shown.
Binary file modified helpers/login.mjs
Binary file not shown.
Binary file added helpers/sendEmail.mjs
Binary file not shown.
9 changes: 9 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"capsolver": "^1.0.1",
"dotenv": "^16.3.1",
"nodemailer": "^6.9.7",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-stealth": "^2.11.2"
},
Expand All @@ -17,7 +18,8 @@
"prettier": "3.1.0"
},
"scripts": {
"start": "node add-to-cart.mjs",
"start-booker": "node add-to-cart.mjs",
"start-checker": "node check-for-changes.mjs",
"prettier:write": "prettier --write ."
}
}

0 comments on commit b95c945

Please sign in to comment.