Skip to content

Commit

Permalink
chore: add bot-check to test-action.yml (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal authored Jan 9, 2024
1 parent e02db1c commit e050f87
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e050f87

Please sign in to comment.