diff --git a/.github/workflows/set-milestone-on-pr.yaml b/.github/workflows/set-milestone-on-pr.yaml index 6013af4..6a8e593 100644 --- a/.github/workflows/set-milestone-on-pr.yaml +++ b/.github/workflows/set-milestone-on-pr.yaml @@ -9,6 +9,10 @@ on: - edited - ready_for_review - review_requested +env: + INITIAL_TAG: 1.0.0 + FALLBACK_TAG: not_found + DEPENDABOT_APP_ID: 49699333 jobs: set-milestone: name: Set Milestone @@ -21,17 +25,23 @@ jobs: - name: 'Get Previous tag' id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v1" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + with: + fallback: ${{ env.FALLBACK_TAG }} - name: 'Get next versions' id: semvers + if: steps.previoustag.outputs.tag != env.FALLBACK_TAG uses: "WyriHaximus/github-action-next-semvers@v1" with: version: ${{ steps.previoustag.outputs.tag }} - name: 'Decide which version fits this PR' id: decidedversion run: | - if [ "$(jq '.sender.id' -r ${GITHUB_EVENT_PATH})" = "49699333" ]; then + if [ "${PREVIOUS_TAG}" = "${FALLBACK_TAG}" ]; then + printf "::set-output name=version::%s" "${INITIAL_TAG}" + exit 0 + fi + + if [ "$(jq '.sender.id' -r ${GITHUB_EVENT_PATH})" = "${DEPENDABOT_APP_ID}" ]; then printf "::set-output name=version::%s" "${PATCH}" exit 0 fi @@ -45,6 +55,7 @@ jobs: printf "::set-output name=version::%s" "${MINOR}" env: + PREVIOUS_TAG: ${{ steps.previoustag.outputs.tag }} MAJOR: ${{ steps.semvers.outputs.major }} MINOR: ${{ steps.semvers.outputs.minor }} PATCH: ${{ steps.semvers.outputs.patch }} @@ -65,7 +76,7 @@ jobs: - name: 'Create Milestone' if: steps.querymilestone.outputs.number == '' id: createmilestone - uses: "WyriHaximus/github-action-create-milestone@0.1.0" + uses: "WyriHaximus/github-action-create-milestone@v1" with: title: ${{ steps.decidedversion.outputs.version }} env: