Conditional run

This commit is contained in:
alesapin 2021-10-26 13:34:12 +03:00
parent 99a3e9996a
commit 8eb6c5fba9
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,6 @@ on: # yamllint disable-line rule:truthy
jobs:
CheckLabels:
runs-on: [self-hosted, style-checker]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'pr-documentation') && !contains(github.event.pull_request.labels.*.name, 'pr-doc-fix') }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
@ -22,6 +21,7 @@ jobs:
python3 run_check.py
DockerHubPush:
needs: CheckLabels
if: ${{ !contains(github.event.pull_request.labels.*.name, 'pr-documentation') && !contains(github.event.pull_request.labels.*.name, 'pr-doc-fix') }}
runs-on: [self-hosted, style-checker]
steps:
- name: Check out repository code

View File

@ -122,5 +122,9 @@ if __name__ == "__main__":
commit.create_status(context=NAME, description=description, state="failure", target_url=url)
sys.exit(1)
else:
print("::notice ::Can run")
commit.create_status(context=NAME, description=description, state="pending", target_url=url)
if 'pr-documentation' in pr_info.labels or 'pr-doc-fix' in pr_info.labels:
commit.create_status(context=NAME, description="Skipping checks for documentation", state="success", target_url=url)
print("::notice ::Can run, but it's documentation PR, skipping")
else:
print("::notice ::Can run")
commit.create_status(context=NAME, description=description, state="pending", target_url=url)