chore: add cron to update electron-* data dependencies (#5130)
This commit is contained in:
Родитель
97dc6546b8
Коммит
ef42f6427d
|
@ -0,0 +1,31 @@
|
|||
const { Octokit } = require('@octokit/action')
|
||||
|
||||
const octokit = new Octokit()
|
||||
|
||||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')
|
||||
|
||||
async function main () {
|
||||
const prs = await octokit.pulls.list({
|
||||
owner,
|
||||
repo,
|
||||
state: 'open',
|
||||
head: `${owner}:update-data`
|
||||
})
|
||||
|
||||
if (prs.data.length === 0) {
|
||||
const pr = await octokit.pulls.create({
|
||||
owner,
|
||||
repo,
|
||||
title: 'build(deps): update electron data packages',
|
||||
base: 'master',
|
||||
head: 'update-data',
|
||||
body: 'Auto-update from GitHub Actions.',
|
||||
maintainer_can_modify: true
|
||||
})
|
||||
console.log('Pull request created:', pr.html_url)
|
||||
} else {
|
||||
console.log('Pull request updated:', prs.data[0].html_url)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
|
@ -0,0 +1,40 @@
|
|||
name: Update electron-* data packages
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 18 * * *"
|
||||
|
||||
jobs:
|
||||
updateElectronDataPackages:
|
||||
name: Auto-update Electron data
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- run: npm ci
|
||||
- name: Switch to update branch
|
||||
run: |
|
||||
if git branch --remotes | grep -q origin/update-data; then
|
||||
git checkout update-data
|
||||
else
|
||||
git checkout -b update-data
|
||||
fi
|
||||
- run: npm run update-data
|
||||
- name: Commit package update changes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "machine github.com login $GITHUB_ACTOR password $GITHUB_TOKEN" > ~/.netrc
|
||||
chmod 600 ~/.netrc
|
||||
git add package.json package-lock.json
|
||||
if test -n "$( git status -s)"; then
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "electron-bot@users.noreply.github.com"
|
||||
git diff
|
||||
git commit -m "build(deps): update electron data packages"
|
||||
git push --set-upstream origin update-data
|
||||
node --unhandled-rejections=strict .github/actions/create-pr.js
|
||||
else
|
||||
echo No update needed
|
||||
fi
|
|
@ -2607,6 +2607,152 @@
|
|||
"fastq": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"@octokit/action": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/action/-/action-3.3.1.tgz",
|
||||
"integrity": "sha512-5MJsLgOn5h8pPvyD7mNItGX33F2Oows6o9BBbFgAWFLIuEGRvIFACAsYpQGTEW9J63DKAHoVvXCIaOO4v22jZQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/auth-action": "^1.2.0",
|
||||
"@octokit/core": "^3.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.2.4",
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.10.1",
|
||||
"@octokit/types": "^6.0.3"
|
||||
}
|
||||
},
|
||||
"@octokit/auth-action": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-1.3.2.tgz",
|
||||
"integrity": "sha512-eCFGNq30e8ObTh6fwcmq8JRaGoputPQtPi9PTgbsEo+NPd5JrOoynI2bV7OpePRqgtATp1JRWC0y/3iXTB11ow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/auth-token": "^2.4.0",
|
||||
"@octokit/types": "^6.0.3"
|
||||
}
|
||||
},
|
||||
"@octokit/auth-token": {
|
||||
"version": "2.4.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz",
|
||||
"integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^6.0.3"
|
||||
}
|
||||
},
|
||||
"@octokit/core": {
|
||||
"version": "3.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.5.tgz",
|
||||
"integrity": "sha512-+DCtPykGnvXKWWQI0E1XD+CCeWSBhB6kwItXqfFmNBlIlhczuDPbg+P6BtLnVBaRJDAjv+1mrUJuRsFSjktopg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/auth-token": "^2.4.4",
|
||||
"@octokit/graphql": "^4.5.8",
|
||||
"@octokit/request": "^5.4.12",
|
||||
"@octokit/types": "^6.0.3",
|
||||
"before-after-hook": "^2.1.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "6.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz",
|
||||
"integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^6.0.3",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-plain-object": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@octokit/graphql": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.0.tgz",
|
||||
"integrity": "sha512-CJ6n7izLFXLvPZaWzCQDjU/RP+vHiZmWdOunaCS87v+2jxMsW9FB5ktfIxybRBxZjxuJGRnxk7xJecWTVxFUYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/request": "^5.3.0",
|
||||
"@octokit/types": "^6.0.3",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/openapi-types": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-4.0.1.tgz",
|
||||
"integrity": "sha512-k2hRcfcLRyPJjtYfJLzg404n7HZ6sUpAWAR/uNI8tf96NgatWOpw1ocdF+WFfx/trO1ivBh7ckynO1rn+xAw/Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@octokit/plugin-paginate-rest": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.9.1.tgz",
|
||||
"integrity": "sha512-8wnuWGjwDIEobbBet2xAjZwgiMVTgIer5wBsnGXzV3lJ4yqphLU2FEMpkhSrDx7y+WkZDfZ+V+1cFMZ1mAaFag==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^6.8.0"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "4.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.10.1.tgz",
|
||||
"integrity": "sha512-YGMiEidTORzgUmYZu0eH4q2k8kgQSHQMuBOBYiKxUYs/nXea4q/Ze6tDzjcRAPmHNJYXrENs1bEMlcdGKT+8ug==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^6.8.2",
|
||||
"deprecation": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz",
|
||||
"integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/endpoint": "^6.0.1",
|
||||
"@octokit/request-error": "^2.0.0",
|
||||
"@octokit/types": "^6.7.1",
|
||||
"deprecation": "^2.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"once": "^1.4.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-plain-object": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@octokit/request-error": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz",
|
||||
"integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/types": "^6.0.3",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "6.8.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.8.2.tgz",
|
||||
"integrity": "sha512-RpG0NJd7OKSkWptiFhy1xCLkThs5YoDIKM21lEtDmUvSpbaIEfrxzckWLUGDFfF8RydSyngo44gDv8m2hHruUg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/openapi-types": "^4.0.0",
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
},
|
||||
"@primer/css": {
|
||||
"version": "15.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@primer/css/-/css-15.2.0.tgz",
|
||||
|
@ -3700,6 +3846,12 @@
|
|||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"before-after-hook": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.1.tgz",
|
||||
"integrity": "sha512-5ekuQOvO04MDj7kYZJaMab2S8SPjGJbotVNyv7QYFCOAwrGZs/YnoDNlh1U+m5hl7H2D/+n0taaAV/tfyd3KMA==",
|
||||
"dev": true
|
||||
},
|
||||
"big.js": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||
|
@ -6133,6 +6285,12 @@
|
|||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"deprecation": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
||||
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==",
|
||||
"dev": true
|
||||
},
|
||||
"des.js": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz",
|
||||
|
@ -11932,6 +12090,12 @@
|
|||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz",
|
||||
"integrity": "sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"dev": true
|
||||
},
|
||||
"node-gyp": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz",
|
||||
|
@ -16792,6 +16956,12 @@
|
|||
"unist-util-is": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"universal-user-agent": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
|
||||
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==",
|
||||
"dev": true
|
||||
},
|
||||
"universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
"lint": "npm run lint:js && npm run lint:style",
|
||||
"lint:js": "eslint . --fix",
|
||||
"lint:style": "stylelint 'public/styles/**/*.scss' --fix",
|
||||
"heroku-postbuild": "npm run precompile-assets"
|
||||
"heroku-postbuild": "npm run precompile-assets",
|
||||
"update-data": "node script/update-data.js"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -86,8 +87,9 @@
|
|||
"ultimate-pagination": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.26.14",
|
||||
"@octokit/action": "^3.3.1",
|
||||
"babel-loader": "^8.2.2",
|
||||
"browser-sync": "^2.26.14",
|
||||
"chai": "^4.3.0",
|
||||
"chai-cheerio": "^1.0.0",
|
||||
"check-for-leaks": "^1.2.1",
|
||||
|
@ -96,10 +98,10 @@
|
|||
"eslint": "^7.19.0",
|
||||
"eslint-config-prettier": "^6.15.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"handlebars-loader": "^1.7.1",
|
||||
"husky": "^4.3.8",
|
||||
"lint-staged": "^10.5.4",
|
||||
"mocha": "^8.2.1",
|
||||
"handlebars-loader": "^1.7.1",
|
||||
"nock": "^13.0.7",
|
||||
"node-sass": "^5.0.0",
|
||||
"nodemon": "^2.0.7",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
const child_process = require('child_process')
|
||||
|
||||
const packages = [
|
||||
'electron-api-historian',
|
||||
'electron-apps',
|
||||
'electron-releases',
|
||||
'electron-i18n',
|
||||
]
|
||||
|
||||
const packagesString = packages.map((str) => `${str}@latest`).join(' ')
|
||||
const command = `npm install ${packagesString} --save-exact`
|
||||
|
||||
console.time(`Running ${command}`)
|
||||
child_process.execSync(command, {
|
||||
stdio: 'inherit',
|
||||
})
|
||||
console.timeEnd(`Running ${command}`)
|
Загрузка…
Ссылка в новой задаче