-
Notifications
You must be signed in to change notification settings - Fork 365
61 lines (53 loc) · 1.68 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
name: Test
# This workflow tests the tag action and can be used on PRs to detect (some) breaking changes.
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
push:
branches:
- master
workflow_dispatch:
jobs:
test-action:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
# Use the action to generate a tag for itself
- name: Test action
id: test
uses: ./
env:
DRY_RUN: true
WITH_V: true
PRERELEASE_SUFFIX: test
VERBOSE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check if the action created the expected output
- name: Check if the tag would have been created
shell: bash
run: |
OUTPUT_TAG=${{ steps.test.outputs.tag }}
OUTPUT_NEWTAG=${{ steps.test.outputs.new_tag }}
OUTPUT_PART=${{ steps.test.outputs.part }}
echo "Outputs from running the action:" >> $GITHUB_SUMMARY
echo "Tag: $OUTPUT_TAG" >> $GITHUB_SUMMARY
echo "New tag: $OUTPUT_NEWTAG" >> $GITHUB_SUMMARY
echo "Part: $OUTPUT_PART" >> $GITHUB_SUMMARY
# Work out what the new tag should be
a=( ${OUTPUT_TAG//./ } )
((a[1]++))
a[2]=0
CORRECT_TAG="v${a[0]}.${a[1]}.${a[2]}-test.0"
if [[ $OUTPUT_NEWTAG == $CORRECT_TAG ]]; then
echo "The tag was created correctly" >> $GITHUB_SUMMARY
else
echo "The tag was not created correctly, expected $CORRECT_TAG got $OUTPUT_NEWTAG" >> $GITHUB_SUMMARY
exit 1
fi