|
| 1 | +name: GH Check CLI Linter |
| 2 | +on: |
| 3 | + pull_request_target: |
| 4 | + types: [opened, labeled, unlabeled, synchronize] |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + |
| 8 | +permissions: {} |
| 9 | + |
| 10 | +jobs: |
| 11 | + azdev-linter: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + pull-requests: read |
| 15 | + contents: read |
| 16 | + steps: |
| 17 | + - name: Checkout CLI repo |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 1 |
| 21 | + sparse-checkout: | |
| 22 | + .github |
| 23 | + - name: Azdev Env Setup |
| 24 | + uses: ./.github/actions/env-setup |
| 25 | + - name: Get Base Branch |
| 26 | + env: |
| 27 | + bash_sha: ${{ github.event.pull_request.base.sha }} |
| 28 | + base_branch: ${{ github.event.pull_request.base.ref }} |
| 29 | + base_repo: ${{ github.event.pull_request.base.repo.clone_url }} |
| 30 | + base_branch_pre: "upstream" |
| 31 | + diff_sha: ${{ github.event.pull_request.head.sha }} |
| 32 | + diff_branch: ${{ github.event.pull_request.head.ref }} |
| 33 | + repo_full_name: ${{ github.event.pull_request.head.repo.full_name }} |
| 34 | + run: | |
| 35 | + set -x |
| 36 | + git --version |
| 37 | + git log --oneline | head -n 10 |
| 38 | + git branch -a |
| 39 | + git fetch "$base_repo" "$base_branch":"$base_branch_pre"/"$base_branch" |
| 40 | + git checkout "$base_branch_pre"/"$base_branch" |
| 41 | + - name: Run Azdev Style |
| 42 | + env: |
| 43 | + pr_label_list: ${{ toJson(github.event.pull_request.labels.*.name) }} |
| 44 | + pr_user: ${{ github.event.pull_request.user.login }} |
| 45 | + base_branch: ${{ github.event.pull_request.base.ref }} |
| 46 | + base_branch_pre: "upstream" |
| 47 | + diff_branch: ${{ github.event.pull_request.head.ref }} |
| 48 | + run: | |
| 49 | + chmod +x env/bin/activate |
| 50 | + source ./env/bin/activate |
| 51 | + set -ev |
| 52 | +
|
| 53 | + git checkout -f "$diff_branch" |
| 54 | + # always use the latest scripts from base branch |
| 55 | + git checkout "$base_branch_pre"/"$base_branch" -- scripts |
| 56 | + git checkout "$base_branch_pre"/"$base_branch" -- .github |
| 57 | + |
| 58 | + python scripts/ci/service_name.py |
| 59 | + merge_base=$(git merge-base HEAD "$base_branch_pre"/"$base_branch") |
| 60 | + echo merge_base: "$merge_base" |
| 61 | + azdev linter --ci-exclusions --min-severity medium --repo ./ --src "$diff_branch" --tgt "$merge_base" |
0 commit comments