diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index 4b3b30ab..04844aee 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -4,6 +4,12 @@ on: pull_request: push: branches: main + workflow_dispatch: + inputs: + commit_sha: + description: 'Commit SHA to build' + required: false + type: string jobs: generate_matrix: @@ -13,6 +19,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.commit_sha || github.event.pull_request.head.sha || github.sha }} - name: Get changed directories id: changed-files @@ -36,8 +44,9 @@ jobs: run: | contains_dot=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".")) | length') contains_dotgithub=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".github")) | length') + is_manual_trigger=$(echo '${{ github.event.inputs.commit_sha }}') - if [[ "${GITHUB_REF}" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then + if [[ -z "$is_manual_trigger" || "${GITHUB_REF}" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then filtered_array='["flight_computer","ground_station","telemetry"]' else filtered_array='${{ steps.changed-files.outputs.all_changed_files }}'