Skip to content

Add the ability to specify the working directory #124

Add the ability to specify the working directory

Add the ability to specify the working directory #124

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- 'master'
pull_request:
jobs:
get-previous-tag-with-working-directory:
name: Test Get Previous Tag on ${{ matrix.os }} with Working Directory
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- uses: actions/checkout@v4
with:
repository: git@github.com:WyriHaximus/php-fake-php-version.git
ref: master
path: tmp/some/other/path
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: 'Get Previous tag'
id: previoustag
uses: ./
with:
workingDirecvtory: tmp/some/other/path
- run: |
echo "Tag: ${{ steps.previoustag.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}"
test -n "${{ steps.previoustag.outputs.tag }}"
test -n "${{ steps.previoustag.outputs.timestamp }}"
- name: Assert we got the tag
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: v1
actual: ${{ steps.previoustag.outputs.tag }}
get-previous-tag:
name: Test Get Previous Tag on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: 'Get Previous tag'
id: previoustag
uses: ./
- run: |
echo "Tag: ${{ steps.previoustag.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}"
test -n "${{ steps.previoustag.outputs.tag }}"
test -n "${{ steps.previoustag.outputs.timestamp }}"
- name: Assert we got the tag
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: v1
actual: ${{ steps.previoustag.outputs.tag }}
- name: Add tag with prefix
run: |
git tag tag-with-prefix-v1.0.0
- name: 'Get Previous tag with prefix'
id: previoustagwithprefix
uses: ./
with:
prefix: tag-with-prefix-v
- run: |
echo "Tag: ${{ steps.previoustagwithprefix.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustagwithprefix.outputs.timestamp }}"
test -n "${{ steps.previoustagwithprefix.outputs.tag }}"
test -n "${{ steps.previoustagwithprefix.outputs.timestamp }}"
- name: Remove tags
uses: JesseTG/rm@v1.0.2
with:
path: .git/refs/tags
- name: Assert we got the tag with the expected prefix
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: tag-with-prefix-v1.0.0
actual: ${{ steps.previoustagwithprefix.outputs.tag }}
- name: 'Get Previous tag with fallback'
id: previoustagwithfallback
uses: ./
with:
fallback: v1.0.0
- run: |
echo "Tag: ${{ steps.previoustagwithfallback.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustagwithfallback.outputs.timestamp }}"
test -n "${{ steps.previoustagwithfallback.outputs.tag }}"
test -n "${{ steps.previoustagwithfallback.outputs.timestamp }}"
- name: Assert we got the fallback
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: v1.0.0
actual: ${{ steps.previoustagwithfallback.outputs.tag }}