From e050f87a210f4569626232c6399b22d9b38d3367 Mon Sep 17 00:00:00 2001 From: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com> Date: Tue, 9 Jan 2024 20:24:14 +0530 Subject: [PATCH] chore: add bot-check to test-action.yml (#373) --- .github/workflows/test-action.yml | 41 +++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index e866be065..bf72fbc2b 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -5,8 +5,33 @@ on: types: [ opened, synchronize, reopened, ready_for_review ] jobs: + should-workflow-run: + runs-on: ubuntu-latest + steps: + - if: > + !github.event.pull_request.draft && !( + (github.actor == 'asyncapi-bot' && ( + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || + startsWith(github.event.pull_request.title, 'chore(release):') + )) || + (github.actor == 'asyncapi-bot-eve' && ( + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || + startsWith(github.event.pull_request.title, 'chore(release):') + )) || + (github.actor == 'allcontributors[bot]' && + startsWith(github.event.pull_request.title, 'docs: add') + ) + ) + id: should_run + name: Should Run + run: echo "shouldrun=true" >> $GITHUB_OUTPUT + outputs: + shouldrun: ${{ steps.should_run.outputs.shouldrun }} + test-defaults: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -27,7 +52,9 @@ jobs: fi test-validate-success: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -37,7 +64,9 @@ jobs: command: validate test-custom-command: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -60,7 +89,9 @@ jobs: fi test-custom-output: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -82,7 +113,9 @@ jobs: fi test-file-not-found: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -101,7 +134,9 @@ jobs: fi test-invalid-input: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -122,7 +157,9 @@ jobs: fi test-optimize: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action @@ -145,7 +182,9 @@ jobs: fi test-bundle: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Make output directory @@ -168,7 +207,9 @@ jobs: fi test-convert: + if: ${{ needs.should-workflow-run.outputs.shouldrun == 'true' }} runs-on: ubuntu-latest + needs: should-workflow-run steps: - uses: actions/checkout@v4 - name: Test GitHub Action diff --git a/package.json b/package.json index 082e67ff2..0645b35e9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "scripts": { "test": "make test", "generate:assets": "echo 'No additional assets need to be generated at the moment'", - "docker:build": "docker build -t asyncapi/github-action-for-cli:latest ." + "docker:build": "docker build -t asyncapi/github-action-for-cli:latest .", + "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" }, "repository": { "type": "git",