Skip to content

Commit

Permalink
Enable manual triggering of Merge Criteria workflow (#379)
Browse files Browse the repository at this point in the history
Closes #380
  • Loading branch information
stojadin2701 authored Apr 21, 2024
1 parent f2ac84d commit dd4beb5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/merge-criteria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}'
Expand Down

0 comments on commit dd4beb5

Please sign in to comment.