diff --git a/.github/workflows/build_loop.yml b/.github/workflows/build_loop.yml index 52c00dedb..84844cbd0 100644 --- a/.github/workflows/build_loop.yml +++ b/.github/workflows/build_loop.yml @@ -1,11 +1,13 @@ -name: 4. Build Loop +name: Triggered Loop Build run-name: Build Loop (${{ github.ref_name }}) on: workflow_dispatch: - schedule: - # Check for updates every Sunday - # Later logic builds if there are updates or if it is the 2nd Sunday of the month - - cron: "33 7 * * 0" # Sunday at UTC 7:33 + inputs: + dispatched_by_trigger: + description: 'Whether this was dispatched from the trigger scheduled workflow' + required: false + type: boolean + default: false env: GH_PAT: ${{ secrets.GH_PAT }} @@ -157,7 +159,7 @@ jobs: uses: ./.github/workflows/create_certs.yml secrets: inherit if: | - github.event_name == 'workflow_dispatch' || + (github.event_name == 'workflow_dispatch' && github.event.inputs.dispatched_by_trigger != 'true') || (vars.SCHEDULED_BUILD != 'false' && needs.check_status.outputs.IS_SECOND_IN_MONTH == 'true') || (vars.SCHEDULED_SYNC != 'false' && needs.check_status.outputs.NEW_COMMITS == 'true' ) @@ -170,7 +172,7 @@ jobs: contents: write if: | # builds with manual start; if scheduled: once a month or when new commits are found - github.event_name == 'workflow_dispatch' || + (github.event_name == 'workflow_dispatch' && github.event.inputs.dispatched_by_trigger != 'true') || (vars.SCHEDULED_BUILD != 'false' && needs.check_status.outputs.IS_SECOND_IN_MONTH == 'true') || (vars.SCHEDULED_SYNC != 'false' && needs.check_status.outputs.NEW_COMMITS == 'true' ) steps: diff --git a/.github/workflows/trigger_build.yml b/.github/workflows/trigger_build.yml new file mode 100644 index 000000000..4f8db27f1 --- /dev/null +++ b/.github/workflows/trigger_build.yml @@ -0,0 +1,25 @@ +name: 4. Trigger Build Loop +run-name: Trigger Build Loop (${{ github.ref_name }}) +on: + workflow_dispatch: + schedule: + - cron: "33 7 * * 0" # Sunday at UTC 7:33 + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: Trigger target workflow + env: + GH_PAT: ${{ secrets.GH_PAT }} + run: | + curl --fail -X PUT \ + -H "Authorization: Bearer ${GH_PAT}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/build_loop.yml/enable + + curl --fail -X POST \ + -H "Authorization: Bearer ${GH_PAT}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/build_loop.yml/dispatches \ + -d '{"ref":"${{ github.ref_name }}", "inputs": {"dispatched_by_trigger": "true"}}'