-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce npmCheckDay
parameter to update-deps
workflow
#28
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c42d342
Add missing 'chalk' dependency.
Dumluregn afcbd99
Make the log a bit more readable.
Dumluregn e61ca57
Add some details to the testing description.
Dumluregn 54f276f
Add more test cases for 'update-deps' workflow.
Dumluregn eaf2925
Add handling of missing 'package.json' file to 'update-deps.js' workf…
Dumluregn 20ed2c0
Fix config options in test fixtures.
Dumluregn 507e4aa
Add possibility to run either npm-check or npm update on target day i…
Dumluregn 11b1653
Rename npmCheckDate -> npmCheckDay.
Dumluregn a4a5dda
Handle 'bump' property from config
sculpt0r fdffb85
create bump-deps workflow
sculpt0r f2fc5c0
empty cfg test case for bump deps
sculpt0r cfb99ba
Add test case with config to merge
sculpt0r 247f9fa
Add test case with bump on false in cfg
sculpt0r a9fa54c
Lower version of package in test input
sculpt0r c8f2585
Switch to less precise node version
sculpt0r 87959ba
Update workflows naming
sculpt0r 8add31c
Rename workflow file to match new naming.
sculpt0r fd43312
Update workflows description
sculpt0r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v14.16.1 | ||
v14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "fixtures", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "setup-workflows.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"core-js": "2.0.0", | ||
"eslint": "5.0.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "3.0.0" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "fixtures", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "setup-workflows.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"core-js": "^2.6.12", | ||
"eslint": "^7.27.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "^4.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const dotenv = require( 'dotenv' ); | ||
const chalk = require( 'chalk' ); | ||
|
||
function config() { | ||
dotenv.config(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
let date = new Date(); | ||
let testNpmCheck = true; | ||
let npmCheckDay = testNpmCheck ? date.getDate() : date.getDate() + 1; | ||
|
||
module.exports = [ | ||
{ | ||
name: 'update-deps branch without package.json file', | ||
workflow: 'update-deps-semversion.yml', | ||
branch: 'master', | ||
config: { | ||
'targetBranch': 'master' | ||
} | ||
}, { | ||
name: 'update-deps on up-to-date branch', | ||
workflow: 'update-deps-semversion.yml', | ||
branch: 'master', | ||
config: { | ||
'targetBranch': 'master' | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-up-to-date.json', | ||
dest: 'package.json' | ||
} ] | ||
}, { | ||
name: 'update-deps PR', | ||
workflow: 'update-deps-semversion.yml', | ||
branch: 'master', | ||
config: { | ||
'targetBranch': 'master' | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-outdated.json', | ||
dest: 'package.json' | ||
} ] | ||
}, { | ||
name: 'update-deps with npm-check on custom day of month', | ||
workflow: 'update-deps-semversion.yml', | ||
branch: 'master', | ||
config: { | ||
'npmCheckDay': npmCheckDay | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-outdated.json', | ||
dest: 'package.json' | ||
} ] | ||
}, { | ||
name: 'update-deps on non-existing branch', | ||
workflow: 'update-deps-semversion.yml', | ||
branch: 'master', | ||
config: { | ||
'targetBranch': 'main' | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-outdated.json', | ||
dest: 'package.json' | ||
} ] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = [ | ||
{ | ||
name: 'update-deps with empty init cfg', | ||
workflow: 'update-deps-to-newest.yml', | ||
branch: 'master', | ||
config: {}, | ||
fileList: [ { | ||
src: 'deps-package-outdated-fixed-version.json', | ||
dest: 'package.json' | ||
} ] | ||
}, | ||
{ | ||
name: 'update-deps with targetBranch in cfg', | ||
workflow: 'update-deps-to-newest.yml', | ||
branch: 'master', | ||
config: { | ||
targetBranch: 'master' | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-outdated-fixed-version.json', | ||
dest: 'package.json' | ||
} ] | ||
}, | ||
{ | ||
name: 'update-deps with bump on false in cfg', | ||
workflow: 'update-deps-to-newest.yml', | ||
branch: 'master', | ||
config: { | ||
targetBranch: 'master', | ||
bump: 'false' | ||
}, | ||
fileList: [ { | ||
src: 'deps-package-outdated-fixed-version.json', | ||
dest: 'package.json' | ||
} ] | ||
} | ||
]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Update NPM dependencies(to newest) | ||
on: | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
workflow_dispatch: | ||
inputs: | ||
config: | ||
description: 'Config' | ||
required: false | ||
default: '' | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Read config | ||
run: | | ||
CONFIG='{}' | ||
if [[ ! -z '${{ github.event.inputs.config }}' ]]; then | ||
CONFIG='${{ github.event.inputs.config }}' | ||
elif [[ -f "./.github/workflows-config.json" ]]; then | ||
CONFIG=$( jq -c .updateDeps './.github/workflows-config.json' ) | ||
fi | ||
echo "Workflow config: $CONFIG" | ||
echo "CONFIG=$CONFIG" >> $GITHUB_ENV | ||
- name: Merge configs | ||
run: | | ||
CONFIG=$(echo '${{ env.CONFIG }}' | jq -c '. += {"bump": "true"}') | ||
# echo "${CONFIG}" | ||
INPUT_1='{ "config": "' | ||
INPUT_2=$(echo "${CONFIG//\"/\\\"}") | ||
INPUT_3='"}' | ||
INPUT_ALL="${INPUT_1} ${INPUT_2} ${INPUT_3}" | ||
echo "INPUT_ALL=$INPUT_ALL" >> $GITHUB_ENV | ||
- name: Invoke workflow with inputs | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: Update NPM dependencies(semversion) | ||
token: ${{ secrets.GH_WORKFLOWS_TOKEN }} | ||
inputs: ${{ env.INPUT_ALL }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends - if you create a repo in
ckeditor
org (which below sampleenv
file contents suggests), our standardGH_BOT_*
values should work here? Or not 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR they didn't work and you need to provide your own... ;( They seem to be active if you take a look into repo settings, but they are not working with the script... If you override them with the new one - it works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I think the solution with a separate workflow that dispatches another workflow seems to be most valid for me. We can freely manipulate the schedule with cron. If we decide that the current approach (once a month) is no longer valid we'll be forced to adjust a lot of code. We do the effort now and have a more elastic solution.