forked from fkirc/skip-duplicate-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (74 loc) · 2.21 KB
/
test.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build & Test
on: # Rebuild any PRs and main branch changes
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build: # Make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Build
run: npm run all
pre_job: # Make sure the action works on a clean machine without building
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run action
uses: ./
id: skip_check
with:
concurrent_skipping: 'never'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md", "**/docs/**"]'
main_job:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Simulate task
run: echo "Running slow tests..." && sleep 30
skip_individual_steps_job:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run action
uses: ./
id: skip_check
with:
cancel_others: 'false'
paths: '["src/**", "dist/**"]'
- name: Simulate task
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
run: |
echo "Run only if src/ or dist/ changed..." && sleep 30
echo "Do other stuff..."
private_action:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run action
uses: ./
id: skip_check
with:
paths_ignore: '["**/*.md"]'
cancel_others: 'true'
concurrent_skipping: 'outdated_runs'
skip_after_successful_duplicate: 'true'
# Test 'do_not_skip' with 'pull_request'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
- name: Simulate task
if: ${{ steps.skip_check.outputs.should_skip == 'false' }}
run: |
echo "Do stuff..." && sleep 30