microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
container

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/repo-policy-check.yml

71lines · modecode

1# Copyright (c) Microsoft Corporation.
2# Licensed under the MIT License.
3
4name: repo-policy-check
5
6on:
7 pull_request:
8 branches: ["main"]
9 merge_group:
10 branches: ["main"]
11
12concurrency:
13 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14 cancel-in-progress: true
15
16permissions:
17 contents: read
18
19jobs:
20 check-submodules:
21 name: Repo Policy Check
22 runs-on: ubuntu-latest
23 steps:
24 - name: Checkout
25 uses: actions/checkout@v4
26 with:
27 submodules: "false"
28 # token: ${{ secrets.PAT_TOKEN }}
29 - uses: pnpm/action-setup@v4
30 name: Install pnpm
31 with:
32 package_json_file: ts/package.json
33 run_install: |
34 - args: [--frozen-lockfile, --strict-peer-dependencies, --ignore-scripts]
35 cwd: ts
36 - name: Check Repo Policy
37 run: |
38 node ts/tools/scripts/repo-policy-check.mjs
39 - name: Check Submodule
40 if: false # This step is disabled and will be skipped
41 run: |
42 echo GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME
43 echo GITHUB_BASE_REF: $GITHUB_BASE_REF
44 echo GITHUB_REF: $GITHUB_REF
45 echo GITHUB_SHA: $GITHUB_SHA
46
47 if [ "$GITHUB_EVENT_NAME" == "merge_group" ]; then
48 BASE_REF=$(echo $GITHUB_REF | cut -d/ -f4)
49 else
50 BASE_REF=$GITHUB_BASE_REF
51 fi
52
53 echo BASE_REF: $BASE_REF
54 git fetch origin $BASE_REF --recurse-submodules=no
55
56 SUBMODULE_PATH=ts/packages/dispatcher/test/repo
57 SUBMODULE_TARGET_SHA=`git ls-tree --object-only $GITHUB_SHA $SUBMODULE_PATH`
58 echo "Target: $GITHUB_SHA Submodule: $SUBMODULE_TARGET_SHA"
59 BASE_SHA=`git show-ref refs/remotes/origin/$BASE_REF --hash`
60 SUBMODULE_BASE_SHA=`git ls-tree --object-only $BASE_SHA $SUBMODULE_PATH`
61 echo "Base: $BASE_REF $BASE_SHA Submodule: $SUBMODULE_BASE_SHA"
62
63 if [ "$SUBMODULE_TARGET_SHA" == "$SUBMODULE_BASE_SHA" ]; then
64 exit 0
65 fi
66
67 cd $SUBMODULE_PATH
68 git fetch origin $SUBMODULE_BASE_SHA
69 git fetch origin $SUBMODULE_TARGET_SHA --depth 50
70 echo "Checking git merge-base --is-ancestor $SUBMODULE_BASE_SHA $SUBMODULE_TARGET_SHA"
71 git merge-base --is-ancestor $SUBMODULE_BASE_SHA $SUBMODULE_TARGET_SHA
72