Skip to content

Commit

Permalink
Test fetch-tags option in an actual workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertWieczoreck committed Jul 1, 2023
1 parent b896fd2 commit f2e2167
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/test-fetch-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test fetch-tags

on:
push:
branches:
- add-fetch-tags-option-staging-test

jobs:
test-fetch-tags:
runs-on: ubuntu-latest
steps:
- uses: AutoModality/action-clean@v1.1.0
- name: 1. Checkout without options
uses: RobertWieczoreck/checkout@add-fetch-tags-option
- name: 1. Expect no tags
run: |
tagCount=$(git tag | wc -l)
if [[ $tagCount != 0 ]]; then
echo "$tagCount tags found - 0 expected!" && exit 1
fi
- uses: AutoModality/action-clean@v1.1.0
- name: 2. Checkout with fetch-depth=0 and fetch-tags=false (default)
uses: RobertWieczoreck/checkout@add-fetch-tags-option
with:
fetch-depth: 0
- name: 2. Expect all tags
run: |
tagCount=$(git tag | wc -l)
if [[ $tagCount != 29 ]]; then
echo "$tagCount tags found - 29 expected!" && exit 1
fi
- uses: AutoModality/action-clean@v1.1.0
- name: 3. Checkout with fetch-depth=0 and fetch-tags=true
uses: RobertWieczoreck/checkout@add-fetch-tags-option
with:
fetch-depth: 0
fetch-tags: true
- name: 3. Expect all tags
run: |
tagCount=$(git tag | wc -l)
if [[ $tagCount != 29 ]]; then
echo "$tagCount tags found - 29 expected!" && exit 1
fi
- uses: AutoModality/action-clean@v1.1.0
- name: 4. Checkout with fetch-depth=10 and fetch-tags=false
uses: RobertWieczoreck/checkout@add-fetch-tags-option
with:
fetch-depth: 10
fetch-tags: false
- name: 4. Expect no tags
run: |
tagCount=$(git tag | wc -l)
if [[ $tagCount != 0 ]]; then
echo "$tagCount tags found - 0 expected!" && exit 1
fi
- uses: AutoModality/action-clean@v1.1.0
- name: 5. Checkout with fetch-depth=20 and fetch-tags=true
uses: RobertWieczoreck/checkout@add-fetch-tags-option
with:
fetch-depth: 20
fetch-tags: true
- name: 5. Expect 3 tags
run: |
tagCount=$(git tag | wc -l)
if [[ $tagCount != 3 ]]; then
echo "$tagCount tags found - 3 expected!" && exit 1
fi

0 comments on commit f2e2167

Please sign in to comment.