name: 'Watch changes in Konflux-ci deployment related files' on: # Can be triggered manually workflow_dispatch: # Every day at 1:00 AM UTC schedule: - cron: '0 1 * * *' jobs: watch-konflux-ci-deployment-files: runs-on: ubuntu-latest env: JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} # secrets PERIODIC_JOBS_SLACK_WEBHOOK_URL: ${{ secrets.PERIODIC_JOBS_SLACK_WEBHOOK_URL }} JOB_TYPE: 'periodic-watch' steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Check files for change id: check-files run: | # List of files used by the deploy-local.sh based deployment FILES=( "scripts/deploy-local.sh" "scripts/setup-kind-local-cluster.sh" "scripts/deploy-secrets.sh" "scripts/resolve-konflux-cr.sh" "deploy-deps.sh" "kind-config.yaml" "generate-err-logs.sh" "operator/config/samples/konflux_v1alpha1_konflux.yaml" "operator/config/samples/konflux-e2e.yaml" "operator/upstream-kustomizations/ui/core/proxy/proxy.yaml" "operator/upstream-kustomizations/ui/core/proxy/kustomization.yaml" ) TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" # Set time range for 24 hours ago in ISO 8601 format (to use in git log) SINCE_DATE=$(date -u -d "24 hours ago" +"%Y-%m-%dT%H:%M:%SZ") git clone --quiet --filter=blob:none --no-checkout --depth=100 https://github.com/konflux-ci/konflux-ci.git repo cd repo git fetch --quiet --no-tags --depth=100 origin main changed_any=0 for file in "${FILES[@]}"; do if git log --since="$SINCE_DATE" --pretty=format: --name-only main -- "$file" | grep -q .; then echo "File changed in last 24h: $file" changed_any=1 fi done # Fail if any file was changed to send a warning to Slack if [[ $changed_any -eq 1 ]]; then echo "At least one watched file was changed in the last 24 hours." echo "files_changed=true" >> "$GITHUB_OUTPUT" exit 1 else echo "No watched files were changed in the last 24 hours." echo "files_changed=false" >> "$GITHUB_OUTPUT" exit 0 fi - name: Report job result to Slack if: ${{ always() }} run: | if [[ "${{ steps.check-files.outputs.files_changed }}" == 'false' ]]; then echo "Job was successful, skipping Slack report to limit noise in channel" elif [[ "${{ steps.check-files.outputs.files_changed }}" == 'true' ]]; then ./pr_check.sh send-report failure ":warning: $(date '+%b %-d') Konflux-ci deployment related files changed, please check if the deploy action needs to be updated :warning:" else ./pr_check.sh send-report failure fi