diff options
author | Daniel Park <gimli01@github.com> | 2021-05-24 00:08:19 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-27 22:42:39 +0300 |
commit | 3d5df0082ae904dacdea8644286e8362d4a2ed50 (patch) | |
tree | 2e571d1387b9e43b5924346fec56ae631bc55053 /.github | |
parent | 7b56bfdf3f2ac67a926fc7893b883a16b46eb3fd (diff) |
chore(ci): add input to cli deps pr workflow
Moves workflow to create NPM CLI dependency pull request from npm/node.
Adds input to workflow dispatch trigger
PR-URL: https://github.com/npm/cli/pull/3294
Credit: @gimli01
Close: #3294
Reviewed-by: @darcyclarke
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/create-cli-deps-pr.yml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/.github/workflows/create-cli-deps-pr.yml b/.github/workflows/create-cli-deps-pr.yml new file mode 100644 index 000000000..ec5397aa8 --- /dev/null +++ b/.github/workflows/create-cli-deps-pr.yml @@ -0,0 +1,42 @@ +name: "Create CLI Deps PR" + +on: + workflow_dispatch: + inputs: + npmVersion: + description: "NPM Version" + required: true + default: '"6.x.x" or "latest"' + +jobs: + create-pull-request: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.NPM_ROBOT_USER_PAT }} + NPM_VERSION: ${{ github.event.inputs.npmVersion }} + steps: + - name: Checkout npm/node + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: master + repository: "npm/node" + token: ${{ secrets.NPM_ROBOT_USER_PAT }} + - name: Run dependency updates and create PR + run: | + npm_tag="" + if [ "$NPM_VERSION" == "latest" ] + then + npm_tag=`npm view npm@latest version` + else + npm_tag="$NPM_VERSION" + fi + + git config user.name "npm-robot" + git config user.email "ops+robot@npmjs.com" + git checkout -b "npm-$npm_tag" + ./tools/update-npm.sh "$npm_tag" + git push origin "npm-$npm_tag" + gh_release_body=`gh release view v"$npm_tag" -R npm/cli` + echo $gh_release_body + gh pr create -R "npm/node" -B "$base_branch" -H "npm:$release_branch_name" --title "deps(cli): upgrade npm to $npm_version" --body "$gh_release_body" |