Skip to content

Commit

Permalink
Merge pull request #81 from Progi1984/check-data-modules
Browse files Browse the repository at this point in the history
`check:data:modules` : Update `@data/demo/modules` every night
  • Loading branch information
Progi1984 authored Jul 11, 2024
2 parents ab5725a + 0d02c82 commit eb19fca
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 26 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/updateModules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Cron Update Modules
on:
schedule:
- cron: '0 23 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
update-composer-modules:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
runs-on: ubuntu-latest
name: Update Modules

steps:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: develop

- name: Checkout PrestaShop
uses: actions/checkout@v4
with:
repository: PrestaShop/PrestaShop
fetch-depth: 1
path: prestashop
ref: develop

- name: Install NPM dependencies
run: npm ci

- name: Execute script for updating modules
run: npm run check:data:modules > cron_php_update_modules.txt

- name: Update PrestaShop packages
id: updated-packages
run: |
if [[ -f cron_php_update_modules.txt ]]; then
FILE_CONTENT=$(cat cron_php_update_modules.txt)
echo PR_BODY=$FILE_CONTENT >> $GITHUB_OUTPUT
rm cron_php_update_modules.txt
else
echo 'Nothing to update'
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
if: ${{steps.updated-packages.outputs.PR_BODY}} != ''
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: cron-php-update-modules
commit-message: '`@data/demo/modules`: Update modules'
title: '`@data/demo/modules`: Update modules'
body: ${{steps.updated-packages.outputs.PR_BODY}}
base: main
delete-branch: true
90 changes: 67 additions & 23 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"lint": "eslint --ignore-path .gitignore .",
"build": "tsc && tsc-alias && npm run copy:assets",
"prepare": "npm run build",
"copy:assets": "cp assets dist/ -R"
"copy:assets": "cp assets dist/ -R",
"// Scripts": "",
"// - Check data modules": "Script to check if data modules are updated",
"check:data:modules": "ts-node -r tsconfig-paths/register src/scripts/updateModules.ts"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -54,6 +57,7 @@
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.29.1",
"tsc-alias": "^1.8.8",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion src/data/demo/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
psFacetedSearch: new FakerModule({
tag: 'ps_facetedsearch',
name: 'Faceted search',
releaseZip: 'https://github.com/PrestaShop/ps_facetedsearch/releases/download/v3.15.1/ps_facetedsearch.zip',
releaseZip: 'https://github.com/PrestaShop/ps_facetedsearch/releases/download/v3.16.1/ps_facetedsearch.zip',
}),
psGdpr: new FakerModule({
tag: 'psgdpr',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MyWishlistsPage extends FOBasePage implements FoMyWishlistsPageInterface {
await page.locator(this.wishlistListItemNthLink(nth)).click();

if (await this.elementNotVisible(page, foClassicMyWishlistsViewPage.productListEmpty, 3000)) {
await this.elementVisible(page, foClassicMyWishlistsViewPage.productListEmpty, 3000)
await this.elementVisible(page, foClassicMyWishlistsViewPage.productListEmpty, 3000);
}
}

Expand Down

0 comments on commit eb19fca

Please sign in to comment.