mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-20 15:03:04 +00:00
6104324436
Add repository guard (github.repository == 'velero-io/velero') to workflows that should only run on the upstream repo. This prevents unnecessary CI runs on forks like openshift/velero where these workflows either fail due to missing secrets/config or duplicate fork-specific CI. Guarded workflows: auto_assign_prs, auto_label_prs, auto_request_review, e2e-test-kind, nightly-trivy-scan, pr-changelog-check, pr-codespell, pr-filepath-check, pr-linter-check, prow-action, rebase, stale-issues. Intentionally left unguarded: pr-ci-check (useful for contributors on forks), get-go-version (reusable workflow_call only). Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
name: Pull Request Codespell Check
|
|
on: [pull_request]
|
|
jobs:
|
|
|
|
codespell:
|
|
if: github.repository == 'velero-io/velero'
|
|
name: Run Codespell
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Check out the code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Codespell
|
|
uses: codespell-project/actions-codespell@master
|
|
with:
|
|
# ignore the config/.../crd.go file as it's generated binary data that is edited elsewhere.
|
|
skip: .git,*.png,*.jpg,*.woff,*.ttf,*.gif,*.ico,./config/crd/v1beta1/crds/crds.go,./config/crd/v1/crds/crds.go,./config/crd/v2alpha1/crds/crds.go,./go.sum,./LICENSE
|
|
ignore_words_list: iam,aks,ist,bridget,ue,shouldnot,atleast,notin,sme,optin,sie
|
|
check_filenames: true
|
|
check_hidden: true
|
|
|
|
- name: Velero.io word list check
|
|
shell: bash {0}
|
|
run: |
|
|
IGNORE_COMMENT="Velero.io word list : ignore"
|
|
FILES_TO_CHECK=$(find . -type f \
|
|
! -path "./.git/*" \
|
|
! -path "./site/content/docs/v*" \
|
|
! -path "./changelogs/CHANGELOG-*" \
|
|
! -path "./.github/workflows/pr-codespell.yml" \
|
|
! -path "./site/static/fonts/Metropolis/Open Font License.md" \
|
|
! -regex '.*\.\(png\|jpg\|woff\|ttf\|gif\|ico\|svg\)'
|
|
)
|
|
function check_word_in_files() {
|
|
local word=$1
|
|
|
|
xargs grep -Iinr "$word" <<< "$FILES_TO_CHECK" | \
|
|
grep -v "$IGNORE_COMMENT" | \
|
|
grep -i --color=always "$word" && \
|
|
EXIT_STATUS=1
|
|
}
|
|
function check_word_case_sensitive_in_files() {
|
|
local word=$1
|
|
|
|
xargs grep -Inr "$word" <<< "$FILES_TO_CHECK" | \
|
|
grep -v "$IGNORE_COMMENT" | \
|
|
grep --color=always "$word" && \
|
|
EXIT_STATUS=1
|
|
}
|
|
EXIT_STATUS=0
|
|
check_word_case_sensitive_in_files ' kubernetes '
|
|
check_word_in_files 'on-premise\b'
|
|
check_word_in_files 'back-up'
|
|
check_word_in_files 'plug-in'
|
|
check_word_in_files 'whitelist'
|
|
check_word_in_files 'blacklist'
|
|
exit $EXIT_STATUS
|