Skip to content

Commit

Permalink
Add custom workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
muzahidul-opti committed Nov 28, 2024
1 parent 867e157 commit a878df8
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
sdk_branch:
description: "Specify the SDK branch"
required: false
default: "master"
testapp_branch:
description: "Specify the test app branch"
required: false
default: "master"

jobs:
unit_test_coverage:
Expand Down Expand Up @@ -36,19 +46,34 @@ jobs:
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
- name: set SDK Branch if PR
env:
HEAD_REF: ${{ github.head_ref }}
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "SDK_BRANCH=$HEAD_REF" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
env:
REF_NAME: ${{ github.ref_name }}
if: ${{ github.event_name != 'pull_request' }}
# Set SDK Branch based on input or PR/Push
- name: Set SDK Branch and Test App Branch
run: |
echo "SDK_BRANCH=$REF_NAME" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=$REF_NAME" >> $GITHUB_ENV
# If manually triggered
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "SDK_BRANCH=${{ github.event.inputs.sdk_branch || 'master' }}" >> $GITHUB_ENV
echo "TESTAPP_BRANCH=${{ github.event.inputs.testapp_branch || 'master' }}" >> $GITHUB_ENV
# If triggered by PR
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
# If triggered by push
else
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
fi
# - name: set SDK Branch if PR
# env:
# HEAD_REF: ${{ github.head_ref }}
# if: ${{ github.event_name == 'pull_request' }}
# run: |
# echo "SDK_BRANCH=$HEAD_REF" >> $GITHUB_ENV
# - name: set SDK Branch if not pull request
# env:
# REF_NAME: ${{ github.ref_name }}
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# echo "SDK_BRANCH=$REF_NAME" >> $GITHUB_ENV
# echo "TRAVIS_BRANCH=$REF_NAME" >> $GITHUB_ENV
- name: Trigger build
env:
SDK: android
Expand Down

0 comments on commit a878df8

Please sign in to comment.