Skip to content

Automatic merge of main into feature_branch/ump-sdk - Jul 20, 2023 #1396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/update-feature-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Update Feature Branches
on:
workflow_dispatch:
inputs:
branch_patterns:
description: 'Space-separated list of feature branch patterns'
default: 'feature_branch/*'
required: true
main_branch:
description: 'Main branch to merge'
default: 'main'
required: true
schedule:
- cron: "0 16 * * 1" # Mondays, 4pm UTC = 9am PST / 10am PDT

env:
defaultBranchPattern: "feature_branch/*"
defaultMainBranch: "main"
triggerTestsLabel: "tests-requested: quick"

jobs:
list_feature_branches:
name: list-feature-branches
runs-on: ubuntu-20.04
outputs:
branch_list: ${{ steps.get-branches.outputs.branch_list }}
steps:
- name: Check out repo (if needed)
if: ${{ github.event.inputs.branch_list == '' }}
uses: actions/checkout@v3

- name: Get list of feature branches
id: get-branches
run: |
branch_pattern='origin/${{ env.defaultBranchPattern }}'
if [[ -n '${{ github.event.inputs.branch_patterns }}' ]]; then
branch_pattern=origin/$(echo '${{ github.event.inputs.branch_patterns }}' | sed 's| | origin/|g')
fi
git remote update
echo "Branch pattern: ${branch_pattern}"
branch_list=$(git branch --list --all "${branch_pattern}")
if [[ -n ${branch_list} ]]; then
# If there's at least one entry, process the list.
echo "Remote branch list: ${branch_list}"
# Remove remotes/origin/ from each branch.
branch_list=$(echo ${branch_list} | sed 's| remotes/origin/| |g' | sed 's|^remotes/origin/||')
# Change spaces to commas.
branch_list=$(echo ${branch_list} | sed 's/ /,/g')
# Add quotes around each branch name.
branch_list='"'$(echo ${branch_list} | sed 's/,/","/g')'"'
fi
echo "::warning ::Branch list: [${branch_list}]"
echo "branch_list=[${branch_list}]" >> $GITHUB_OUTPUT

create_merge_prs:
name: create-merge-pr-${{ matrix.branch_name }}
needs: [ list_feature_branches ]
runs-on: ubuntu-20.04
if: ${{ needs.list_feature_branches.outputs.branch_list != '[]' }}
strategy:
fail-fast: false
matrix:
branch_name: ${{ fromJson(needs.list_feature_branches.outputs.branch_list) }}
steps:
- name: Get token for firebase-workflow-trigger
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }}
private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }}

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.7

- uses: actions/checkout@v3
with:
ref: ${{ matrix.branch_name }}
fetch-depth: 0
submodules: false

- name: Install prerequisites
run: |
python scripts/gha/install_prereqs_desktop.py
python -m pip install requests

- name: Create merge PR
id: create-pr
run: |
git config user.email "[email protected]"
git config user.name "firebase-workflow-trigger-bot"
git config core.commentChar "%" # so we can use # in git commit messages

main_branch='${{ env.defaultMainBranch }}'
if [[ -n '${{ github.event.inputs.main_branch }}' ]]; then
main_branch='${{ github.event.inputs.main_branch }}'
fi
# Attempt a merge, then check if any files changed.
git merge --no-commit --no-ff "origin/${main_branch}" || true
if git diff --quiet ${{ matrix.branch_name }}; then
# No merge necessary.
echo "::warning ::No merge needed for ${{ matrix.branch_name }}, won't create pull request."
echo "created_pr_number=0" >> $GITHUB_OUTPUT
exit 0
fi

# Undo the actual merge. Let the PR creation handle it.
git merge --abort

date_str=$(date "+%b %d, %Y")

pr_title="Automatic merge of ${main_branch} into ${{ matrix.branch_name }} - ${date_str}"
pr_body="Automatic merge of ${main_branch} into ${{ matrix.branch_name }}.

> Created on ${date_str} by [${{github.workflow}} workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID).
"
pr_number=$(python scripts/gha/create_pull_request.py --token ${{ steps.generate-token.outputs.token }} --base "${{ matrix.branch_name }}" --head "${main_branch}" --title "${pr_title}" --body "${pr_body}")
echo "created_pr_number=${pr_number}" >> $GITHUB_OUTPUT

- name: Set test trigger label.
uses: actions-ecosystem/action-add-labels@v1
if: ${{ steps.create-pr.outputs.created_pr_number }}
with:
github_token: ${{ steps.generate-token.outputs.token }}
number: ${{ steps.create-pr.outputs.created_pr_number }}
labels: "${{ env.triggerTestsLabel }}"
2 changes: 1 addition & 1 deletion gma/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform :ios, '11.0'
use_frameworks! :linkage => :static

target 'integration_test' do
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/CoreOnly', '10.12.0'
pod 'Google-Mobile-Ads-SDK', '10.8.0'
end

Expand Down
4 changes: 2 additions & 2 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Firebase Functions | firebase_functions.xcframework
| | Firebase/Auth Cocoapod (10.12.0)
Google Mobile Ads | firebase_gma.xcframework
| | firebase.xcframework
| | Firebase/Analytics Cocoapod (10.12.0)
| | Firebase/CoreOnly Cocoapod (10.12.0)
| | Google-Mobile-Ads-SDK Cocoapod (10.8.0)
Firebase Installations | firebase_installations.xcframework
| | firebase.xcframework
Expand Down Expand Up @@ -312,7 +312,7 @@ Firebase Functions | libfirebase_functions.a
| | Firebase/Auth Cocoapod (10.12.0)
Google Mobile Ads | libfirebase_gma.a
| | libfirebase_app.a
| | Firebase/Analytics Cocoapod (10.12.0)
| | Firebase/CoreOnly Cocoapod (10.12.0)
| | Google-Mobile-Ads-SDK Cocoapod (10.8.0)
Firebase Installations | libfirebase_installations.a
| | libfirebase_app.a
Expand Down