From d41947c6fd39aeecfbcc63e93831fbd1b86e9bd1 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Fri, 4 Dec 2026 19:02:51 +0700 Subject: [PATCH] ci: skip duplicate push and pull_request test runs Merging a PR that's up to date with dev pushes a commit whose tree the PR run already tested, and the push run of tests.yml tests that tree again. A run-once job now reports when an older run already tested the same tree, and the build job skips in that run. lint still runs every time, because its push run saves the dev caches that PR runs restore. Closes: #238 Signed-off-by: Dwi Siswanto --- .github/workflows/tests.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 37f1448..6a78092 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,6 +17,17 @@ on: jobs: + run-once: + runs-on: ubuntu-slim + permissions: + actions: read + contents: read + outputs: + skip: ${{ steps.run-once.outputs.skip }} + steps: + - id: run-once + uses: projectdiscovery/actions/run-once@v1 + lint: name: Lint Test uses: projectdiscovery/workflows/.github/workflows/golangci-lint.yaml@v1 @@ -26,7 +37,8 @@ jobs: build: name: Test Builds - needs: [lint] + needs: [lint, run-once] + if: needs.run-once.outputs.skip != 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7