forked from microsoft/azurelinux
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (25 loc) · 1.11 KB
/
check-spec.yml
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
name: Check Spec for version and/or release update and parsing
on:
pull_request:
branches: [ main, dev, 1.0* ]
jobs:
build:
name: Check Spec for version and/or release update and parsing
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Get base commit for PRs
run: |
git fetch origin ${{ github.base_ref }}
echo "base_sha=$(git rev-parse origin/${{ github.base_ref }})" >> $GITHUB_ENV
echo "branch=${{ github.base_ref }}" >> $GITHUB_ENV
- name: Get the changed files
run: |
echo "Files changed: '$(git diff-tree --no-commit-id --name-status -r ${{ env.base_sha }} ${{ github.sha }})'"
changed_specs=$(git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -r ${{ env.base_sha }} ${{ github.sha }} | { grep "\.spec$" || test $? = 1; })
echo "Spec Files to validate: '${changed_specs}'"
echo "updated_specs=$(echo ${changed_specs})" >> $GITHUB_ENV
- name: Check each spec
run: |
.github/workflows/validate-spec.sh ${{ env.branch }} ${{ env.updated_specs }}