title: How do I get the previous tag in github actions and then compare it to the current tag?
body: <p>I'm setting up continuous deployment with github actions which I want to run every time a tag is created.
  However I only want to deploy if there has not been a major bump (Using semver for versions) since the last tag.</p>
  <p>I have only been able so far to find actions/examples that get the current tag, not the one before. like (<a href="https://github.com/WyriHaximus/github-action-get-previous-tag" rel="nofollow noreferrer">https://github.com/WyriHaximus/github-action-get-previous-tag</a>)</p>
  <p>How would I do this?</p>
  <p>Edit: (thanks for the tip on <code>git fetch -a</code>) I managed to get it working with <code>git tag</code> and <code>cut</code></p>
  <pre class="lang-yaml prettyprint-override"><code>      - name: Get major of current tag and previous tag
          id: vars
          run: |
            git fetch -a
            echo ::set-output name=current_major::$(git tag --sort &quot;-committerdate&quot; | cut -d$'\n' -f1 | cut -d. -f1)
            echo ::set-output name=previous_major::$(git tag --sort &quot;-committerdate&quot; | cut -d$'\n' -f2 | cut -d. -f1)
  </code></pre>