Skip to content

Commit

Permalink
Check input for empty directories
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Aug 2, 2024
1 parent 0d29f75 commit 0c39d22
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ jobs:
with:
setup_only: true
- run: buf --version | grep $BUF_VERSION
test-empty-build:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: ./
with:
lint: false
format: false
breaking: false
push: false
archive: false
pr_comment: false
continue-on-error: true # build fails
test-lint:
runs-on: ubuntu-latest
needs: build
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Run Buf
uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
```
Expand Down
4 changes: 4 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45828,6 +45828,10 @@ async function runWorkflow(bufPath, inputs, moduleNames) {
const steps = {};
steps.build = await build(bufPath, inputs);
if (steps.build.status == Status.Failed) {
if (steps.build.stderr.match(/had no .proto files/)) {
core.info("Empty repository detected, ensure the repository is checked out");
return steps;
}
return steps;
}
const checks = await Promise.all([
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ async function runWorkflow(
const steps: Steps = {};
steps.build = await build(bufPath, inputs);
if (steps.build.status == Status.Failed) {
if (steps.build.stderr.match(/had no .proto files/)) {
core.info(
"Empty repository detected, ensure the repository is checked out",
);
return steps;
}
return steps;
}
const checks = await Promise.all([
Expand Down

0 comments on commit 0c39d22

Please sign in to comment.