-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to automatically build for npm changes
Signed-off-by: Luca Comellini <[email protected]>
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Run build for dependabot PRs | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: read | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch Dependabot metadata | ||
id: dependabot-metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
|
||
- uses: actions/checkout@v3 | ||
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' }} | ||
with: | ||
ref: ${{ github.head_ref }} | ||
token: ${{ secrets.COMMIT_PAT }} | ||
|
||
- name: Set up Node.js | ||
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install dependencies | ||
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' }} | ||
run: npm ci | ||
|
||
- name: Run build | ||
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' }} | ||
run: | | ||
npm run build | ||
npm run package | ||
- name: Commit changes | ||
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'npm_and_yarn' }} | ||
id: commit | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Update dist/ after build" |