chenzhaoyang
2025-12-17 d3e5a4b7658ece4f845bbc0c4f95acf3fbdf8a61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: 'Follow Merge: Dispatch'
 
on:
  pull_request_target:
    types:
      - opened
      - closed
      - converted_to_draft
      - ready_for_review
      - synchronize
    branches:
      - develop
      - 'lse-release/**'
    paths-ignore:
      - 'label_studio/frontend/**'
      - 'docs/**'
#      - 'web/dist/**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref }}
 
jobs:
  sync:
    name: "Sync"
    if: startsWith(github.head_ref, 'fb-') || startsWith(github.head_ref, 'revert-') || startsWith(github.head_ref, 'cursor')
    runs-on: ubuntu-latest
    steps:
      - uses: hmarr/debug-action@v3.0.0
 
      - name: Check user's membership
        uses: actions/github-script@v8
        id: check-membership
        with:
          github-token: ${{ secrets.GIT_PAT }}
          script: |
            const { repo, owner } = context.repo;
            try {
              return (await github.rest.orgs.getMembershipForUser({
                org: owner,
                username: '${{ github.actor }}',
              }))?.data?.state == "active";
            } catch (error) {
              return false;
            }
 
      - name: Notify user on failure
        if: steps.check-membership.outputs.result == 'false'
        uses: actions/github-script@v8
        with:
          github-token: ${{ secrets.GIT_PAT }}
          script: |
            const { repo, owner } = context.repo;
            const result = await github.rest.issues.createComment({
              owner,
              repo,
              issue_number: '${{ github.event.number }}',
              body: [
                'Hi @${{ github.actor }}!',
                '',
                `Unfortunately you don't have membership in ${owner} organization, Follow Merge dispatch is skipped.`
              ].join('\n')
            });
            throw `${{ github.actor }} don't have membership in ${owner} organization`
 
      - name: Checkout Actions Hub
        uses: actions/checkout@v6
        with:
          token: ${{ secrets.GIT_PAT }}
          repository: HumanSignal/actions-hub
          path: ./.github/actions-hub
 
      - name: Dispatch label-studio-enterprise Follow Merge
        uses: ./.github/actions-hub/actions/follow-merge-dispatch
        with:
          github_token: ${{ secrets.GIT_PAT }}
          downstream_repository: "label-studio-enterprise"