Bump the npm-dependencies group across 1 directory with 10 updates #287
Workflow file for this run
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
name: Dependabot auto update | |
on: pull_request | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-dist: | |
runs-on: ubuntu-latest | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Node.js 20.x | |
uses: actions/[email protected] | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: npm ci | |
- name: Rebuild the dist/ directory | |
run: | | |
npm run build | |
npm run package | |
- name: Setup Git | |
run: | | |
git --version | |
git config user.name "github-actions[bot]" | |
git config user.email "<41898282+github-actions[bot]@users.noreply.github.com>" | |
- name: Push changes if dist changed | |
run: | | |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
git add -all dist/ | |
git commit -m "Build for Dependabot" | |
git push | |
fi | |
dependabot: | |
runs-on: ubuntu-latest | |
needs: update-dist | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
steps: | |
- name: Dependabot metadata | |
id: metadata | |
uses: dependabot/fetch-metadata@v2 | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Approve a PR | |
run: gh pr review --approve "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable auto-merge for Dependabot PRs | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |