From 94d5e3d0f6ef0f6bead9107c8e24edc72e54f822 Mon Sep 17 00:00:00 2001 From: eyedeekay Date: Fri, 9 May 2025 23:07:13 -0400 Subject: [PATCH] sync-on-push --- .github/workflows/sync.yaml | 10 +++------- pkg/workflow/generator.go | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index b44a3c6..8051a50 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -12,12 +12,10 @@ jobs: sync: - env: - GITHUB_ACTIONS_ENVIRONMENT: ${{ github.action }} runs-on: ubuntu-latest steps: - - name: Security Check - run: if [ "$GITHUB_ACTIONS_ENVIRONMENT" == "" ]; then echo "This workflow is only intended to run inside GitHub Actions"; exit 1; fi + - name: Validate Github Actions Environment + run: if [ "$GITHUB_ACTIONS" != "true" ]; then echo 'This script must be run in a GitHub Actions environment.'; exit 1; fi - name: Checkout GitHub Mirror uses: actions/checkout@v3 with: @@ -62,9 +60,7 @@ jobs: git push origin main name: Sync Primary Repository to GitHub Mirror "on": + push: {} schedule: - cron: 0 * * * * workflow_dispatch: {} -permissions: - actions: read - contents: write diff --git a/pkg/workflow/generator.go b/pkg/workflow/generator.go index d58f7cd..9903399 100644 --- a/pkg/workflow/generator.go +++ b/pkg/workflow/generator.go @@ -81,6 +81,7 @@ func generateWorkflowYAML(data WorkflowTemplate) (string, error) { workflow := map[string]interface{}{ "name": "Sync Primary Repository to GitHub Mirror", "on": map[string]interface{}{ + "push": map[string]interface{}{}, "schedule": []map[string]string{ {"cron": data.CronSchedule}, },