Skip to content

Switched to on demand running of workflows in PRs. #285

Switched to on demand running of workflows in PRs.

Switched to on demand running of workflows in PRs. #285

Workflow file for this run

name: main
on:
workflow_dispatch:
inputs:
skip-tests:
description: Skip tests
required: false
default: false
type: boolean
skip-build-app:
description: Skip build-app
required: false
default: false
type: boolean
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review, edited]
defaults:
run:
shell: bash --noprofile --norc -x -euo pipefail {0}
jobs:
paths-filter:
name: 'Paths Filter'
uses: ./.github/workflows/paths-filter.yml
trigger-filter:
name: 'Trigger'
runs-on: ubuntu-latest
outputs:
should-test: ${{ steps.filter.outputs.should-test }}
should-build: ${{ steps.filter.outputs.should-build }}
steps:
- name: 'Filter comments'
if: ${{ github.event_name == 'pull_request' && github.event.action == 'edited' }}
id: filter
run: |
echo "should-test=false" >> $GITHUB_OUTPUT
echo "should-build=false" >> $GITHUB_OUTPUT
jq . "$GITHUB_EVENT_PATH"
new_body=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH")
old_body=$(jq -r '.changes.body.from' "$GITHUB_EVENT_PATH")
if ! [[ "$new_body" =~ '- [x] *Run* checks:' && "$old_body" =~ '- [ ] *Run* checks:' ]]; then
exit 0
fi
if [[ "$new_body" =~ '- [x] all' ]]; then
echo "should-test=true" >> $GITHUB_OUTPUT
echo "should-build=true" >> $GITHUB_OUTPUT
fi
if [[ "$new_body" =~ '- [x] tests' ]]; then
echo "should-test=true" >> $GITHUB_OUTPUT
fi
if [[ "$new_body" =~ '- [x] build app' ]]; then
echo "should-build=true" >> $GITHUB_OUTPUT
fi
tests:
name: 'Tests'
needs: [paths-filter, trigger-filter]
if: ${{ !inputs.skip-tests && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-test != 'false' && needs.trigger-filter.outputs.should-test == 'true' }}
uses: grigorye/ReusableWorkflows/.github/workflows/tests-generic.yml@v20
secrets: inherit
with:
runs-on: 'macos-12'
unit-tests-scheme: 'TMBuddyTests'
snapshot-tests-scheme: 'TMBuddySnapshots'
ui-snapshot-tests-scheme: 'TMBuddyUITestSnapshots'
build-app:
name: 'App'
needs: [paths-filter, trigger-filter]
if: ${{ !inputs.skip-build-app && github.event.pull_request.draft != true && needs.paths-filter.outputs.should-build != 'false' && needs.trigger-filter.outputs.should-build == 'true' }}
uses: grigorye/ReusableWorkflows/.github/workflows/build-app-generic.yml@v20
with:
macos-app-scheme: 'TMBuddy'
build-configs: '[\"app-store\", \"developer-id\"]'
secrets: inherit