88 push :
99 branches : [main]
1010 pull_request :
11+ types :
12+ - opened
13+ - reopened
14+ - synchronize
15+ - ready_for_review
16+
17+ concurrency :
18+ group : ${{ github.workflow }}-${{ github.ref }}
19+ cancel-in-progress : true
20+
21+ env :
22+ USE_RUBY : ${{ vars.USE_RUBY || 'false' }}
23+ USE_YQ : ${{ vars.USE_YQ || 'false' }}
24+ USE_CACHE : ${{ vars.USE_CACHE || 'false' }}
25+ CACHE_FOLDER : ${{ vars.CACHE_FOLDER || '.cache' }}
1126
1227jobs :
1328 test :
14- if : " !contains(github.event.head_commit.message, 'skip ci')"
29+ if : ${{ !contains(github.event.head_commit.message, 'skip ci') && !github.event.pull_request.draft}}
1530 runs-on : ubuntu-latest
1631 steps :
1732 - name : Checkout project (pull-request)
@@ -28,10 +43,12 @@ jobs:
2843 with :
29443045 - name : Setup Ruby
46+ if : ${{ env.USE_RUBY == 'true' }}
3147 uses : ruby/setup-ruby@v1
3248 with :
3349 ruby-version : .ruby-version
3450 - name : Setup yq
51+ if : ${{ env.USE_YQ == 'true' }}
3552 run : sudo snap install yq
3653 - name : Run pre-conditions
3754 run : test -f .github/actions.yml && eval "$(yq e '.pre.ci // "true"' .github/actions.yml)" || true
@@ -42,10 +59,26 @@ jobs:
4259 uses :
stefanzweifel/[email protected] 4360 with :
4461 commit_message : Run formatter/linter
62+ - name : Restore cache
63+ id : ci-cache-restore
64+ if : ${{ env.USE_CACHE == 'true' }}
65+ uses : actions/cache/restore@v3
66+ with :
67+ path : |
68+ ${{ env.CACHE_FOLDER }}
69+ key : ci-cache-key
4570 - name : Run checks
4671 run : sbt ci-test
4772 env :
4873 GITHUB_TOKEN : ${{ secrets.ADMIN_GITHUB_TOKEN }}
74+ - name : Save cache
75+ id : ci-cache-save
76+ if : ${{ env.USE_CACHE == 'true' }}
77+ uses : actions/cache/save@v3
78+ with :
79+ path : |
80+ ${{ env.CACHE_FOLDER }}
81+ key : ${{ steps.ci-cache-restore.outputs.cache-primary-key }}
4982 - name : Run post-conditions
5083 run : test -f .github/actions.yml && eval "$(yq e '.post.ci // "true"' .github/actions.yml)" || true
5184 - name : Automerge Scala Steward PRs
0 commit comments