-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a missing tests check and update
CONTRIBUTING.md
(#308)
- Loading branch information
1 parent
b7e83da
commit 9fd6a72
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Check for Tests in PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
check-for-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check for changes in test directory | ||
id: check-tests | ||
run: | | ||
git status --porcelain > changed_files.txt | ||
if grep -qE "^[AM]\s+test/" changed_files.txt; then | ||
echo "Tests found in the PR" | ||
echo "tests_present=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "No tests found in the PR" | ||
echo "tests_present=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Comment on PR if tests are missing | ||
if: steps.check-tests.outputs.tests_present == 'false' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'It appears that this PR does not include any tests. It is recommended to add tests, especially for critical changes, to ensure code quality and prevent regressions. However, if this PR is only updating samples or documentation, feel free to skip adding tests and disregard this comment.' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ scripts: | |
exec: dart analyze . | ||
format: | ||
exec: dart format --set-exit-if-changed . | ||
test: | ||
exec: flutter test |