Bump the actions group across 1 directory with 2 updates #62
Workflow file for this run
This file contains hidden or 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
| # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enabling-automerge-on-a-pull-request | |
| name: Dependabot Automation | |
| on: pull_request | |
| permissions: {} | |
| jobs: | |
| automerge: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # for pushing commits | |
| pull-requests: write # for merging PRs | |
| if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'Swatinem/rust-cache' | |
| steps: | |
| - name: Fetch metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0 | |
| with: | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 2 | |
| persist-credentials: false | |
| if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | |
| - name: Check if package-lock.json has been changed | |
| if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | |
| id: npm | |
| env: | |
| PR_URL: ${{github.event.pull_request.html_url}} | |
| GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| run: | | |
| if ! git diff --quiet HEAD~1.. -- package-lock.json; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "changed=true, checking out $PR_URL to allow amend" | |
| gh pr checkout "$PR_URL" | |
| fi | |
| - name: Setup node if necessary | |
| if: steps.npm.outputs.changed != '' | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version: 20.x | |
| cache: npm | |
| - name: Re-generate and commit dist/ if changed | |
| id: amend | |
| if: steps.npm.outputs.changed != '' | |
| run: | | |
| npm ci | |
| npm run prepare | |
| if ! git diff --quiet dist/*/index.js; then | |
| echo "dist/ changed, amending last commit" | |
| export $(git log -1 --pretty=format:'GIT_COMMITTER_NAME=%cn GIT_COMMITTER_EMAIL=%ce GIT_AUTHOR_NAME=%an GIT_AUTHOR_EMAIL=%ae') | |
| git fetch --unshallow | |
| echo "Before amend:" && git show --name-only --pretty= | |
| git commit --amend --no-edit --no-reset-author -- dist/*/index.js | |
| echo "After amend:" && git show --name-only --pretty= | |
| git push --force-with-lease origin HEAD | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Auto-merge Patch PRs | |
| if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | |
| run: gh pr merge --auto --merge "$PR_URL" | |
| env: | |
| PR_URL: ${{github.event.pull_request.html_url}} | |
| GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |