Skip to content

Commit bed41c0

Browse files
author
Kostiantyn Kostiuk
committed
wip2
1 parent 46914e3 commit bed41c0

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

.github/workflows/check.yml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,35 @@ on:
55
branches: [ master ]
66

77
jobs:
8+
check-run:
9+
name: Check CI run
10+
runs-on: ubuntu-latest
11+
outputs:
12+
need-run: ${{ steps.check.outputs.need-run }}
13+
env:
14+
PR_LABEL_DEPS: contains(github.event.pull_request.labels.*.name, 'dependencies')
15+
PR_LABEL_RUBY: contains(github.event.pull_request.labels.*.name, 'ruby')
16+
PR_LABEL_RBI: contains(github.event.pull_request.labels.*.name, 'rbi-ready')
17+
PR_NEED_RUN: |
18+
(contains(github.event.pull_request.labels.*.name, 'dependencies') &&
19+
contains(github.event.pull_request.labels.*.name, 'ruby') &&
20+
contains(github.event.pull_request.labels.*.name, 'tapioca-ready')) || (
21+
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
22+
!contains(github.event.pull_request.labels.*.name, 'ruby'))
23+
steps:
24+
- name: Dump PR labels
25+
run: |
26+
echo "PR_LABEL_DEPS: ${{ env.PR_LABEL_DEPS }}"
27+
echo "PR_LABEL_RUBY: ${{ env.PR_LABEL_RUBY }}"
28+
echo "PR_LABEL_RBI: ${{ env.PR_LABEL_RBI }}"
29+
echo "PR_NEED_RUN: ${{ env.PR_NEED_RUN }}"
30+
- name: Check for dependencies label
31+
id: check
32+
run: echo ::set-output name=need-run::${{ env.PR_NEED_RUN }}
33+
834
analyze:
35+
needs: [ check-run ]
36+
if: needs.check-run.outputs.need-run == 'true'
937
name: Analyze
1038
runs-on: ubuntu-latest
1139

@@ -35,12 +63,8 @@ jobs:
3563
uses: github/codeql-action/analyze@v3
3664

3765
rspec:
38-
if: |
39-
(contains(github.event.pull_request.labels.*.name, 'dependencies') &&
40-
contains(github.event.pull_request.labels.*.name, 'ruby') &&
41-
contains(github.event.pull_request.labels.*.name, 'tapioca-ready')) || (
42-
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
43-
!contains(github.event.pull_request.labels.*.name, 'ruby'))
66+
needs: [ check-run ]
67+
if: needs.check-run.outputs.need-run == 'true'
4468
runs-on: ubuntu-20.04
4569
strategy:
4670
fail-fast: false
@@ -54,12 +78,8 @@ jobs:
5478
run: bundle exec rspec
5579

5680
typecheck:
57-
if: |
58-
(contains(github.event.pull_request.labels.*.name, 'dependencies') &&
59-
contains(github.event.pull_request.labels.*.name, 'ruby') &&
60-
contains(github.event.pull_request.labels.*.name, 'tapioca-ready')) || (
61-
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
62-
!contains(github.event.pull_request.labels.*.name, 'ruby'))
81+
needs: [ check-run ]
82+
if: needs.check-run.outputs.need-run == 'true'
6383
runs-on: ubuntu-20.04
6484
strategy:
6585
fail-fast: false
@@ -76,12 +96,8 @@ jobs:
7696
run: bundle exec srb typecheck
7797

7898
rubocop:
79-
if: |
80-
(contains(github.event.pull_request.labels.*.name, 'dependencies') &&
81-
contains(github.event.pull_request.labels.*.name, 'ruby') &&
82-
contains(github.event.pull_request.labels.*.name, 'tapioca-ready')) || (
83-
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
84-
!contains(github.event.pull_request.labels.*.name, 'ruby'))
99+
needs: [ check-run ]
100+
if: needs.check-run.outputs.need-run == 'true'
85101
runs-on: ubuntu-20.04
86102
strategy:
87103
fail-fast: false

0 commit comments

Comments
 (0)