diff --git a/.github/workflows/post-dependabot.yml b/.github/workflows/post-dependabot.yml new file mode 100644 index 00000000..11a5dacf --- /dev/null +++ b/.github/workflows/post-dependabot.yml @@ -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}} diff --git a/lib/content/post-dependabot.yml b/lib/content/post-dependabot.yml new file mode 100644 index 00000000..11a5dacf --- /dev/null +++ b/lib/content/post-dependabot.yml @@ -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}} diff --git a/lib/postinstall/copy-content.js b/lib/postinstall/copy-content.js index 1ce39dad..939755c1 100644 --- a/lib/postinstall/copy-content.js +++ b/lib/postinstall/copy-content.js @@ -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', }