Actions: Detect code changes (#107326)
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
name: Detect changed files
|
||||
description: Detects whether any matching files have changed in the current PR
|
||||
inputs:
|
||||
self:
|
||||
description: The path to the calling workflow (e.g. .github/workflows/backend-unit-tests.yml). It is regarded as any category.
|
||||
required: true
|
||||
outputs:
|
||||
self:
|
||||
description: Whether the calling workflow has changed in any way
|
||||
value: ${{ steps.changed-files.outputs.self_any_changed || 'true' }}
|
||||
backend:
|
||||
description: Whether the backend or self have changed in any way
|
||||
value: ${{ steps.changed-files.outputs.backend_any_changed || 'true' }}
|
||||
frontend:
|
||||
description: Whether the frontend or self has changed in any way
|
||||
value: ${{ steps.changed-files.outputs.frontend_any_changed || 'true' }}
|
||||
e2e:
|
||||
description: Whether the e2e tests or self have changed in any way
|
||||
value: ${{ steps.changed-files.outputs.e2e_any_changed == 'true' ||
|
||||
steps.changed-files.outputs.backend_any_changed == 'true' ||
|
||||
steps.changed-files.outputs.frontend_any_changed == 'true' || 'true' }}
|
||||
dev-tooling:
|
||||
description: Whether the dev tooling or self have changed in any way
|
||||
value: ${{ steps.changed-files.outputs.dev_tooling_any_changed || 'true' }}
|
||||
docs:
|
||||
description: Whether the docs or self have changed in any way
|
||||
value: ${{ steps.changed-files.outputs.docs_any_changed || 'true' }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# Assumption: We've done a checkout with the actions/checkout action.
|
||||
# It must persist credentials to allow the changed-files action to get more history.
|
||||
- name: Detect changes
|
||||
id: changed-files
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
|
||||
with:
|
||||
files_yaml: |
|
||||
self:
|
||||
- '.github/actions/change-detection/**'
|
||||
- '${{ inputs.self }}'
|
||||
backend:
|
||||
- '!*.md'
|
||||
- '!docs/**'
|
||||
- '!.github/**'
|
||||
- '.github/actions/setup-enterprise/**'
|
||||
- '.github/actions/checkout/**'
|
||||
- '**/go.mod'
|
||||
- '**/go.sum'
|
||||
- '**.go'
|
||||
- 'pkg/**'
|
||||
- '!pkg/**.md'
|
||||
- 'apps/**'
|
||||
- '!apps/**.md'
|
||||
- 'build.sh'
|
||||
- '.github/actions/change-detection/**'
|
||||
- '**.cue'
|
||||
- 'devenv/docker/blocks/*_tests/**'
|
||||
- 'kindsv2/**'
|
||||
- '${{ inputs.self }}'
|
||||
frontend:
|
||||
- '.github/actions/setup-enterprise/**'
|
||||
- '.github/actions/checkout/**'
|
||||
- 'public/**'
|
||||
- '**.js'
|
||||
- '**.jsx'
|
||||
- '**.ts'
|
||||
- '**.tsx'
|
||||
- '**.css'
|
||||
- '**.mjs'
|
||||
- 'yarn.lock'
|
||||
- 'package.json'
|
||||
- '!**.md'
|
||||
- '.github/actions/change-detection/**'
|
||||
- '**.cue'
|
||||
- '.prettier*'
|
||||
- '.betterer*'
|
||||
- '.yarnrc.yml'
|
||||
- 'eslint.config.js'
|
||||
- 'jest.config.js'
|
||||
- 'nx.json'
|
||||
- 'tsconfig.json'
|
||||
- '.yarn/**'
|
||||
- '${{ inputs.self }}'
|
||||
e2e:
|
||||
- 'e2e/**'
|
||||
- '.github/actions/setup-enterprise/**'
|
||||
- '.github/actions/checkout/**'
|
||||
- 'emails/**'
|
||||
- 'pkg/**'
|
||||
- 'proto/**'
|
||||
- '**/Makefile'
|
||||
- 'scripts/**'
|
||||
- '!scripts/drone/**'
|
||||
- '!**.md'
|
||||
- '.github/actions/change-detection/**'
|
||||
- '**.cue'
|
||||
- 'conf/**'
|
||||
- 'cypress.config.js'
|
||||
- '${{ inputs.self }}'
|
||||
dev_tooling:
|
||||
- '.github/actions/setup-enterprise/**'
|
||||
- '.github/actions/checkout/**'
|
||||
- '**.sh'
|
||||
- '.trivyignore'
|
||||
- '.prettierrc.js'
|
||||
- '**/Makefile'
|
||||
- 'proto/**.yaml'
|
||||
- 'pkg/build/**'
|
||||
- 'pkg/wire/**'
|
||||
- 'scripts/**'
|
||||
- '!**.md'
|
||||
- '.citools/**'
|
||||
- '.bingo/**'
|
||||
- '.github/actions/change-detection/**'
|
||||
- '${{ inputs.self }}'
|
||||
docs:
|
||||
- 'contribute/**'
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
- '.vale.ini'
|
||||
- '.github/actions/change-detection/**'
|
||||
- '${{ inputs.self }}'
|
||||
- name: Print all change groups
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Self: ${{ steps.changed-files.outputs.self_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.self_all_changed_files }}"
|
||||
echo "Backend: ${{ steps.changed-files.outputs.backend_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.backend_all_changed_files }}"
|
||||
echo "Frontend: ${{ steps.changed-files.outputs.frontend_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.frontend_all_changed_files }}"
|
||||
echo "E2E: ${{ steps.changed-files.outputs.e2e_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.e2e_all_changed_files }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.backend_all_changed_files }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.frontend_all_changed_files }}"
|
||||
echo "Dev Tooling: ${{ steps.changed-files.outputs.dev_tooling_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.dev_tooling_all_changed_files }}"
|
||||
echo "Docs: ${{ steps.changed-files.outputs.docs_any_changed || 'true' }}"
|
||||
echo " --> ${{ steps.changed-files.outputs.docs_all_changed_files }}"
|
||||
Reference in New Issue
Block a user