Files
quik/.github/workflows/auto-update-mms-configs.yml
T
Inhishonor bf92808a91 Fix All errors
Uses create-pull-request to commit changes, sets up a bash script to check for duplicates, runs every 3 months.
2025-03-21 18:27:35 -07:00

82 lines
2.9 KiB
YAML

name: Auto-Update MMS configs
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 1,4,7,10 *'
jobs:
vvm:
runs-on: ubuntu-latest
env:
DEFAULT_BRANCH: auto-update-mms-configs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Branch Name
run: echo "NEW_BRANCH=update-mms-configs-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
- name: Install apkeep
run: cargo install apkeep
- name: Install aapt and unzip
run: |
sudo apt update
sudo apt -y install aapt unzip
- name: Install Apktool
run: |
wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.11.1.jar
- name: Download Messaging APK
run: apkeep -a com.google.android.apps.messaging -o device=walleye /home/runner/work/quik/quik
- name: Unzip the Messaging APK from XAPK
run: |
unzip /home/runner/work/quik/quik/com.google.android.apps.messaging.xapk -d /home/runner/work/quik/quik
- name: Decompile Messaging using apktool
run: java -jar apktool_2.11.1.jar decode com.google.android.apps.messaging.apk -o dump
- name: Copy MMS configs
run: |
rm -rv android-smsmms/src/main/res/xml-mcc*
cp -rv dump/res/xml-mcc* android-smsmms/src/main/res/
rm -rv android-smsmms/src/main/res/xml-mcc*/*_config_override.xml
- name: Remove Duplicate MMS Config Files
run: |
#!/bin/bash
declare -A seen
for file in android-smsmms/src/main/res/xml-mcc*/mms_config.xml; do
dir_name=$(dirname "$file")
if [[ "$dir_name" == *-mnc00 ]]; then
# Check for corresponding directory without -mnc suffix
base_dir=$(echo "$dir_name" | sed 's/-mnc00//')
if [[ -d "$base_dir" ]]; then
echo "Duplicate found for $base_dir and $dir_name"
rm -rf "$base_dir"
fi
fi
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update MMS configs from com.google.android.apps.messaging.apk.
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
title: "Update MMS configs"
body: |
This pull request updates the MMS configurations to the latest version.
- Updated by [Auto-Update MMS configs] [Auto-Update MMS configs](./.github%2Fworkflows%2Fauto-update-mms-configs.yml)
add-paths: android-smsmms/src/main/res/xml-mcc*
branch: ${{ env.NEW_BRANCH }}
base: ${{ env.DEFAULT_BRANCH }}