Skip to content
Merged
Show file tree
Hide file tree
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
Revert "chore: update pr-check template for security"
  • Loading branch information
GuangmingLuo authored Jun 30, 2025
commit 5257ec2d9bf94b9eccb425d4211dc5dffff1f033
73 changes: 3 additions & 70 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
name: Pull Request Check

on:
pull_request_target:
types:
- opened
- synchronize
- labeled
- reopened

permissions:
contents: read
pull-requests: read
on: [ pull_request ]

jobs:
check-user-trust:
runs-on: ubuntu-latest
outputs:
is-trusted: ${{ steps.check.outputs.is_trusted }}
steps:
- name: Check if PR sender is trusted
id: check
run: |
ASSOC="${{ github.event.sender.author_association }}"
echo "Sender association: $ASSOC"
if [[ "$ASSOC" == "OWNER" || "$ASSOC" == "MEMBER" || "$ASSOC" == "COLLABORATOR" ]]; then
echo "trusted=true" >> $GITHUB_OUTPUT
else
echo "trusted=false" >> $GITHUB_OUTPUT
fi

compliant-check:
needs: check-user-trust
if: needs.check-user-trust.outputs.is_trusted == 'true'
compliant:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -44,12 +16,8 @@ jobs:
- name: Check Spell
uses: crate-ci/typos@master

golangci-lint:
needs: check-user-trust
if: needs.check-user-trust.outputs.is_trusted == 'true'
lint:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
Expand All @@ -66,38 +34,3 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true

unit-benchmark-test:
needs: check-user-trust
if: needs.check-user-trust.outputs.is_trusted == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Unit Test
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...

- name: Benchmark
run: go test -bench=. -benchmem -run=none ./...

compatibility-test:
needs: check-user-trust
if: needs.check-user-trust.outputs.is_trusted == 'true'
strategy:
matrix:
go: [ "1.19", oldstable ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true # don't use cache for self-hosted runners
- name: Unit Test
run: go test -race -covermode=atomic ./...
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Push Check
name: Tests

on: push
on: [ push, pull_request ]

jobs:
unit-benchmark-test:
Expand Down