Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

ci: checks run on pull requests only, and label their own PR

Sidwebworks1e28bbad09cb
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 0af7c8db3b..7ec9c95691 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -1,10 +1,10 @@
name: Checks
+# Pull requests only: a merge to main already passed these on its PR, and a
+# push to main goes straight to Build images.
on:
pull_request:
branches: [main]
- push:
- branches: [main]
permissions:
contents: read
@@ -282,3 +282,31 @@ jobs:
node-version-file: .nvmrc
- run: pnpm audit --audit-level=critical
+
+ # The result as a PR label, for filtering the PR list. Here rather than a
+ # workflow_run, which GitHub pins to main's latest commit. Not on PRs from
+ # forks: their token cannot edit the PR.
+ label:
+ name: Label
+ needs:
+ [install, lint, typecheck, lingui, catalog, test, edge-functions, audit]
+ if: >-
+ !cancelled() &&
+ github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ pull-requests: write
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_REPO: ${{ github.repository }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ PASSED: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
+ steps:
+ - name: Apply checks label
+ run: |
+ if [ "$PASSED" = "true" ]; then
+ gh pr edit "$PR_NUMBER" --remove-label "checks: failing" --add-label "checks: passing"
+ else
+ gh pr edit "$PR_NUMBER" --remove-label "checks: passing" --add-label "checks: failing"
+ fi
diff --git a/.github/workflows/pr-checks-label.yml b/.github/workflows/pr-checks-label.yml
deleted file mode 100644
index 8d6937302d..0000000000
--- a/.github/workflows/pr-checks-label.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: PR Checks Label
-
-on:
- workflow_run:
- workflows:
- - Checks
- types:
- - completed
-
-permissions:
- contents: read
- pull-requests: write
-
-jobs:
- label:
- if: >-
- github.event.workflow_run.event == 'pull_request' &&
- github.event.workflow_run.pull_requests[0].number != null
- runs-on: ubuntu-latest
- timeout-minutes: 5
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- GH_REPO: ${{ github.repository }}
- PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
- steps:
- - name: Ensure labels exist
- run: |
- gh label create "checks: passing" --color "0e8a16" --description "CI checks passed" --force
- gh label create "checks: failing" --color "b60205" --description "CI checks failed" --force
-
- - name: Apply checks label
- run: |
- if [ "${{ github.event.workflow_run.conclusion }}" = "success" ]; then
- gh pr edit "$PR_NUMBER" --remove-label "checks: failing" 2>/dev/null || true
- gh pr edit "$PR_NUMBER" --add-label "checks: passing"
- else
- gh pr edit "$PR_NUMBER" --remove-label "checks: passing" 2>/dev/null || true
- gh pr edit "$PR_NUMBER" --add-label "checks: failing"
- fi