-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (58 loc) · 2.13 KB
/
test.yml
File metadata and controls
70 lines (58 loc) · 2.13 KB
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
name: Test
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
test-extraction:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test extracting from test workflow
id: test-extract
uses: ./
with:
target_repository: actions/checkout
- name: Verify extraction
run: |
echo "Extracted ref: ${{ steps.test-extract.outputs.ref }}"
echo "Method: ${{ steps.test-extract.outputs.extraction_method }}"
# Should extract 'v4' from the checkout action above
if [ "${{ steps.test-extract.outputs.ref }}" != "v4" ]; then
echo "ERROR: Expected ref 'v4', got '${{ steps.test-extract.outputs.ref }}'"
exit 1
fi
if [ "${{ steps.test-extract.outputs.extraction_method }}" != "extracted" ]; then
echo "ERROR: Expected method 'extracted', got '${{ steps.test-extract.outputs.extraction_method }}'"
exit 1
fi
test-default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test with non-existent target
id: test-default
uses: ./
with:
target_repository: fake/nonexistent-repo
default_ref: fallback-branch
- name: Verify default
run: |
echo "Extracted ref: ${{ steps.test-default.outputs.ref }}"
echo "Method: ${{ steps.test-default.outputs.extraction_method }}"
if [ "${{ steps.test-default.outputs.ref }}" != "fallback-branch" ]; then
echo "ERROR: Expected ref 'fallback-branch', got '${{ steps.test-default.outputs.ref }}'"
exit 1
fi
if [ "${{ steps.test-default.outputs.extraction_method }}" != "default" ]; then
echo "ERROR: Expected method 'default', got '${{ steps.test-default.outputs.extraction_method }}'"
exit 1
fi
test-reusable-workflow:
uses: ./.github/workflows/test-reusable.yml@main
test-called-extraction:
needs: test-reusable-workflow
runs-on: ubuntu-latest
steps:
- run: echo "Reusable workflow test completed"