-
Notifications
You must be signed in to change notification settings - Fork 11
37 lines (36 loc) · 1.08 KB
/
check_heards.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
33
34
35
36
37
name: check headers
on:
pull_request:
types: [opened, synchronize]
branches:
- 'master'
jobs:
conditional_job_check_files:
runs-on: 'ubuntu-20.04'
outputs:
docs_changed: ${{ steps.check_file_changed.outputs.docs_changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
- shell: pwsh
id: check_file_changed
run: |
# Diff HEAD with the previous commit
$diff = git diff --name-only HEAD^ HEAD
$SourceDiff = $diff | Where-Object {$_ -match '.sh$' }
$HasDiff = $SourceDiff.Length -gt 0
Write-Host "name=docs_changed::$HasDiff" >>$GITHUB_OUTPUT
# Run the job only with "docs_changed" equals "True"
conditional_job:
runs-on: 'ubuntu-20.04'
needs: [ conditional_job_check_files ]
if: needs.conditional_job_check_files.outputs.docs_changed == 'True'
steps:
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.7.8'
- name: execute py script
run:
python .github/workflows/Scripts/checkImport.py