Skip to content

Commit

Permalink
Merge pull request #23 from dscho/npm-run-package-on-dependabot-prs
Browse files Browse the repository at this point in the history
ci: automagically repackage when Dependabot updates a dependency
  • Loading branch information
dscho authored Feb 12, 2024
2 parents f9e3010 + cc141fa commit 396a172
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/npm-run-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'npm run prepare'
# Main use case: repackage when Dependabot updates a dependency
on:
push:
branches:
- 'dependabot/npm_and_yarn/**'
workflow_dispatch:
inputs:
branch:
description: 'Process this branch'
required: false
type: string

jobs:
npm-run-prepare-and-push: # make sure build/ci work properly
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.repository.owner.login == 'git-for-windows'
environment: git-for-windows-ci-push
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.full_name }}
ref: ${{ inputs.branch }}${{ github.event.ref }}
token: ${{ secrets.GIT_FOR_WINDOWS_CI_PUSH }}
- run: npm ci
- run: npm run prepare
- run: git diff-files
- run: npm run lint
- run: npm run test
- name: check if commit & push is needed
id: check
run: |
git add -u -- dist/ &&
git diff-index --cached --exit-code HEAD -- ||
echo "::set-output name=need-to-commit::yes"
- name: commit & push
if: steps.check.outputs.need-to-commit == 'yes'
run: |
git config user.name "${{github.actor}}" &&
git config user.email "${{github.actor}}@users.noreply.github.com" &&
git commit -m 'npm run prepare' -- dist/ &&
git update-index --refresh &&
git diff-files --exit-code &&
git diff-index --cached --exit-code HEAD -- &&
git push

0 comments on commit 396a172

Please sign in to comment.