Skip to content

Commit

Permalink
fix: run install when dependabot updates us
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Feb 7, 2022
1 parent 3571330 commit 5b49817
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/post-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: "Post Dependabot Actions"
on: pull_request

jobs:
Install:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: npm install and commit
if: ${{contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "ops+npm-cli@npmjs.com"
git config --local user.name "npm cli ops bot"
gh pr checkout ${{ github.event.pull_request.number }}
npm install
git add .
git commit -am "chore: postinstall for dependabot template-oss PR"
git push origin ${{github.ref_name}}
31 changes: 31 additions & 0 deletions lib/content/post-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: "Post Dependabot Actions"
on: pull_request

jobs:
Install:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: npm install and commit
if: ${{contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "ops+npm-cli@npmjs.com"
git config --local user.name "npm cli ops bot"
gh pr checkout ${{ github.event.pull_request.number }}
npm install
git add .
git commit -am "chore: postinstall for dependabot template-oss PR"
git push origin ${{github.ref_name}}
1 change: 1 addition & 0 deletions lib/postinstall/copy-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const repoFiles = {
'.github/dependabot.yml': './dependabot.yml',
'.github/workflows/audit.yml': './audit.yml',
'.github/workflows/codeql-analysis.yml': './codeql-analysis.yml',
'.github/workflows/post-dependabot.yml': './post-dependabot.yml',
'.github/workflows/pull-request.yml': './pull-request.yml',
'.github/workflows/release-please.yml': './release-please.yml',
}
Expand Down

0 comments on commit 5b49817

Please sign in to comment.