diff --git a/.github/workflows/dependabot-build.yml b/.github/workflows/dependabot-build.yml new file mode 100644 index 0000000..28c1631 --- /dev/null +++ b/.github/workflows/dependabot-build.yml @@ -0,0 +1,50 @@ +name: Compile dependabot updates + +on: + workflow_dispatch: + pull_request_target: + +permissions: + pull-requests: write + contents: write +jobs: + fetch-dependabot-metadata: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} + steps: + - name: Fetch dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.2.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + build-dependabot-changes: + runs-on: ubuntu-latest + needs: [fetch-dependabot-metadata] + if: ${{ needs.fetch-dependabot-metadata.outputs.dependency-type == 'direct:production' }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Read .nvmrc + id: nvm + run: echo ::set-output name=NVMRC::$(cat .nvmrc) + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + + - name: Install NPM dependencies + run: npm ci + + - name: Rebuild the dist/ directory + run: npm run package + + - name: Check in any change to dist/ + run: | + git add dist/ + git config user.name github-actions + git config user.email github-actions@github.com + git commit -m "[dependabot skip] Update dist/ with build changes" || exit 0 + git push