forked from jitterbit/get-changed-files
-
Notifications
You must be signed in to change notification settings - Fork 21
119 lines (100 loc) · 3.79 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Print environment variables
run: env
- name: Print events.json
run: cat "$GITHUB_EVENT_PATH"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
yarn
- name: Clean, build, format, lint, package, and test
run: |
yarn all
- name: Check if packaged properly
run: |
# If there are any unstaged or untracked files in 'dist/', then the action wasn't packaged properly
if git diff --name-only | grep '^dist/' || git ls-files --other --exclude-standard | grep '^dist/'; then
echo "You didn't package the action properly before pushing to remote." \
echo "Always run 'yarn all' before staging a commit."
echo "Below are the modified files in 'dist/' after running 'yarn && rm -rf dist/ && yarn all':"
git diff --name-only | grep '^dist/'
git ls-files --other --exclude-standard | grep '^dist/'
exit 1
fi
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: files
uses: ./
name: Run the action without filtering
- name: Print files
run: |
echo 'steps.files.outputs.all=${{ steps.files.outputs.all }}'
echo 'steps.files.outputs.added=${{ steps.files.outputs.added }}'
echo 'steps.files.outputs.modified=${{ steps.files.outputs.modified }}'
echo 'steps.files.outputs.removed=${{ steps.files.outputs.removed }}'
echo 'steps.files.outputs.renamed=${{ steps.files.outputs.renamed }}'
echo 'steps.files.outputs.added_modified=${{ steps.files.outputs.added_modified }}'
echo 'steps.files.outputs.added_modified_renamed=${{ steps.files.outputs.added_modified_renamed }}'
- id: files-filtered
name: Run the action with filtering
uses: ./
with:
filter: |
*.yml
!.github/*/*.yml
*.js
*.ts
package*
!*.json
- name: Print files-filtered
run: |
echo 'steps.files-filtered.outputs.all=${{ steps.files-filtered.outputs.all }}'
echo 'steps.files-filtered.outputs.added=${{ steps.files-filtered.outputs.added }}'
echo 'steps.files-filtered.outputs.modified=${{ steps.files-filtered.outputs.modified }}'
echo 'steps.files-filtered.outputs.removed=${{ steps.files-filtered.outputs.removed }}'
echo 'steps.files-filtered.outputs.renamed=${{ steps.files-filtered.outputs.renamed }}'
echo 'steps.files-filtered.outputs.added_modified=${{ steps.files-filtered.outputs.added_modified }}'
echo 'steps.files-filtered.outputs.added_modified_renamed=${{ steps.files-filtered.outputs.added_modified_renamed }}'