|
1 | 1 | name: Sync PR Gate (Hoodi) |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request_target: |
| 4 | + pull_request: |
5 | 5 | branches: [master] |
6 | | - pull_request_review: |
7 | | - types: [submitted] |
8 | 6 |
|
9 | 7 | concurrency: |
10 | 8 | group: sync-pr-${{ github.event.pull_request.number }} |
|
14 | 12 | DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: "1" |
15 | 13 | TERM: xterm |
16 | 14 |
|
17 | | -jobs: |
18 | | - check-approval: |
19 | | - name: "Check PR approval" |
20 | | - if: >- |
21 | | - github.event_name == 'pull_request_target' || |
22 | | - github.event.review.state == 'approved' |
23 | | - runs-on: ubuntu-latest |
24 | | - outputs: |
25 | | - run: ${{ steps.check.outputs.run }} |
26 | | - steps: |
27 | | - - name: Check if sync should run |
28 | | - id: check |
29 | | - env: |
30 | | - GH_TOKEN: ${{ github.token }} |
31 | | - IS_FORK: ${{ github.event.pull_request.head.repo.fork }} |
32 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
33 | | - run: | |
34 | | - if [ "$IS_FORK" != "true" ]; then |
35 | | - echo "run=true" >> "$GITHUB_OUTPUT" |
36 | | - exit 0 |
37 | | - fi |
38 | | -
|
39 | | - # Fork PR: only run if at least one approval exists |
40 | | - approved=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/reviews" \ |
41 | | - --jq '[.[] | select(.state == "APPROVED")] | length > 0') |
42 | | - echo "run=$approved" >> "$GITHUB_OUTPUT" |
| 15 | +permissions: |
| 16 | + contents: read |
43 | 17 |
|
| 18 | +jobs: |
44 | 19 | sync-hoodi: |
45 | 20 | name: "Sync hoodi (${{ matrix.mode }})" |
46 | | - needs: check-approval |
47 | | - if: needs.check-approval.outputs.run == 'true' |
| 21 | + if: github.event.pull_request.head.repo.fork == false |
48 | 22 | runs-on: ubuntu-arm64-8-core |
49 | 23 | timeout-minutes: 180 |
50 | 24 | strategy: |
|
70 | 44 | uses: actions/checkout@v6 |
71 | 45 | with: |
72 | 46 | ref: ${{ github.event.pull_request.head.sha }} |
| 47 | + persist-credentials: false |
73 | 48 |
|
74 | 49 | - name: Checkout tests repository |
75 | 50 | uses: actions/checkout@v6 |
|
78 | 53 | path: tests |
79 | 54 | token: ${{ steps.gh-app.outputs.token }} |
80 | 55 | clean: true |
| 56 | + persist-credentials: false |
81 | 57 |
|
82 | 58 | - name: Cache apt packages |
83 | 59 | uses: awalsh128/cache-apt-pkgs-action@v1 |
|
0 commit comments