-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add small script + github action to check that public docs updated (#…
…1177) This PR adds a new GitHub Action which will run on PRs against `dev` and `main`. The GitHub action will not run if the label of "no public docs" has been applied to the PR in question: Otherwise, it will check to see if any changes were made to either the `engine` or `grafana-plugin` directories. If so, it will then check whether changes were also made to the `docs` directory. If not, it will fail the job and block the build.
- Loading branch information
1 parent
0a00d3e
commit d3a098d
Showing
2 changed files
with
43 additions
and
0 deletions.
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,23 @@ | ||
#!/bin/bash | ||
|
||
ENGINE_DIR="engine" | ||
UI_DIR="grafana-plugin" | ||
PUBLIC_DOCS_DIR="docs" | ||
|
||
DIRS_CHANGED=$(git diff HEAD~1 --name-only | xargs dirname | sort | uniq) # https://stackoverflow.com/a/73149899/3902555 | ||
|
||
if [[ $DIRS_CHANGED =~ $ENGINE_DIR ]] || [[ $DIRS_CHANGED =~ $UI_DIR ]]; then | ||
echo "Changes were made to the ${ENGINE_DIR} and/or ${UI_DIR} directories" | ||
|
||
# check if we have any changes to the public docs directory as well. If not, | ||
if [[ ! $DIRS_CHANGED =~ $PUBLIC_DOCS_DIR ]]; then | ||
echo "Changes were not made to the public documentation (${PUBLIC_DOCS_DIR} directory). Either update the documentation accordingly with your changes, or add the 'no public docs' label if changes to the public docs are not necessary for your PR." | ||
exit 1 | ||
else | ||
echo "Changes were also made to the public documentation. Thank you!" | ||
exit 0 | ||
fi | ||
|
||
else | ||
echo "Changes were not made to either the ${ENGINE_DIR} or ${UI_DIR} directories" | ||
fi |
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,20 @@ | ||
name: Verify public documentation updated | ||
|
||
on: | ||
pull_request: | ||
types: [assigned, opened, synchronize, reopened, labeled, unlabeled] | ||
branches: | ||
- main | ||
- dev | ||
|
||
jobs: | ||
verify-public-docs-updated: | ||
name: Verify public documentation updated | ||
# Don't run this job if the "no public docs" label is applied to the PR | ||
# https://github.com/orgs/community/discussions/26712#discussioncomment-3253012 | ||
if: "!contains(github.event.pull_request.labels.*.name, 'no public docs')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Public documentation checker | ||
run: ./.github/verify-public-docs-updated.sh |