diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml deleted file mode 100644 index 16b0475f..00000000 --- a/.github/workflows/check-version.yml +++ /dev/null @@ -1,16 +0,0 @@ -on: push - -name: Check package version - -jobs: - checkVersion: - name: Check package version - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Check package version - uses: technote-space/package-version-check-action@v1 - with: - GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - TEST_TAG_PREFIX: test/ - BRANCH_PREFIX: release/ diff --git a/.github/workflows/pr-opened.yml b/.github/workflows/pr-opened.yml index 6d0c6e24..2f4e59c8 100644 --- a/.github/workflows/pr-opened.yml +++ b/.github/workflows/pr-opened.yml @@ -33,3 +33,24 @@ jobs: uses: technote-space/pr-labeler-action@v3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + checkVersion: + name: Check package version + runs-on: ubuntu-latest + if: startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Set running flag + run: echo "::set-env name=RUNNING::1" + - uses: actions/checkout@v2 + - name: Set running flag + run: | + if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then + echo "::set-env name=RUNNING::" + fi + + - name: Check package version + uses: technote-space/package-version-check-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH_PREFIX: release/ + if: env.RUNNING diff --git a/.github/workflows/pr-updated.yml b/.github/workflows/pr-updated.yml index 98b9d810..f5a175af 100644 --- a/.github/workflows/pr-updated.yml +++ b/.github/workflows/pr-updated.yml @@ -1,4 +1,6 @@ -on: pull_request +on: + pull_request: + types: [opened, synchronize] name: Pull Request updated @@ -16,6 +18,7 @@ jobs: assignToProject: name: Assign PullRequest to Project runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -31,6 +34,7 @@ jobs: assignAuthor: name: Assign author to PR runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -44,6 +48,7 @@ jobs: addLabelsByBranch: name: PR Labeler runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -53,3 +58,29 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} IGNORE_CONTEXT_CHECK: true + + checkVersion: + name: Check package version + runs-on: ubuntu-latest + if: github.event.action == 'synchronize' && startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Set running flag + run: echo "::set-env name=RUNNING::" + - uses: actions/checkout@v2 + - uses: technote-space/get-git-comment-action@v1 + - name: Set running flag + run: echo "::set-env name=RUNNING::1" + if: contains(env.COMMIT_MESSAGE, 'trigger workflow') + - name: Set running flag + run: | + if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then + echo "::set-env name=RUNNING::" + fi + + - name: Check package version + uses: technote-space/package-version-check-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH_PREFIX: release/ + IGNORE_CONTEXT_CHECK: true + if: env.RUNNING