@@ -13,6 +13,7 @@ permissions:
1313 pull-requests : read
1414jobs :
1515 lint :
16+ if : ${{ github.repository == 'matterbridge-org/matterbridge' }}
1617 name : golangci-lint
1718 runs-on : ubuntu-latest
1819 steps :
3334 with :
3435 version : v2.1
3536 args : --build-tags=goolm --config=.golangci-incremental.yaml
37+ lint_personal_fork :
38+ if : ${{ github.repository != 'matterbridge-org/matterbridge' }}
39+ name : golangci-lint (personal fork branch)
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v5
43+ # - run: "git remote add upstream https://github.com/matterbridge-org/matterbridge"
44+ # - run: "git fetch upstream master"
45+ # - run: "git branch __ci_upstream_master FETCH_HEAD"
46+ - run : " git fetch --unshallow"
47+ # We only compare with the most recent common ancestor. Otherwise, code that was removed
48+ # upstream but does not conflict (and therefore will not appear in Github PR UI)
49+ # will trigger new linter errors downstream (false positive).
50+ # - run: echo "COMMON_ANCESTOR=$(git merge-base __ci_upstream_master ${{ github.ref }})" >> $GITHUB_ENV
51+ # - run: echo "COMMON_ANCESTOR=$(git merge-base __ci_upstream_master ${{ github.ref }})"
52+ - uses : actions/setup-go@v6
53+ with :
54+ go-version : 1.24.x
55+ - name : golangci-lint
56+ uses : golangci/golangci-lint-action@v8
57+ with :
58+ # Maybe only-new-issues works with a simple unshallow?
59+ only-new-issues : true
60+ version : v2.1
61+ skip-cache : true
62+ args : --build-tags=goolm
63+ # Compare to upstream's master branch.
64+ # It looks like Github Actions partial clones don't really like comparing
65+ # with previous commit overwritten by a force push, which in any case does
66+ # not really make sense when working on a feature branch.
67+ # args: >-
68+ # --build-tags=goolm --new-from-rev=${{ env.COMMON_ANCESTOR }}
3669 test :
3770 strategy :
3871 matrix :
5184 - name : go test -tags goolm ./... (go version ${{ matrix.go-version }})
5285 run : go test -tags goolm ./...
5386 build-upload :
87+ # Dont build artifacts for downstream branches not tracked by a PR
88+ if : ${{ github.event_name == 'pull_request' || github.repository == 'matterbridge-org/matterbridge' }}
5489 # Uploading artifacts only if lint/test succeeded
5590 needs : [ "lint", "test" ]
5691 strategy :
0 commit comments