Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/build-on-dependabot-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build on PR

on:
pull_request:
types: [opened, synchronize]
branches:
- main

jobs:
build:
if: |
github.actor == 'dependabot[bot]' ||
(github.event.pull_request.author_association == 'OWNER' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
github.event.pull_request.author_association == 'MEMBER')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run build command
run: pnpm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist/

- name: Comment on PR
uses: actions/github-script@v6
with:
script: |
try {
const output = `✅ Build completed successfully!\n\nYou can view the build artifacts [here](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
} catch (error) {
const output = `❌ Build failed!\n\nCheck the [workflow logs](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
throw error; // Fail the job
}
Loading