Based on the repository content, I'll help create a default YAML workflow file that would work out of the box for any TWRP 12.1 device. I'll modify your example to include all available inputs from the action.yml and make it more flexible.
Here's the optimized version:
[Redacted Copy code
name: TWRP Build
on:
push:
branches:
- '**' # Matches all branches
paths-ignore:
- 'README.md'
pull_request:
branches:
- '**' # Matches all branches
paths-ignore:
- 'README.md'
workflow_dispatch:
inputs:
manifest_branch:
description: 'TWRP manifest branch'
required: false
default: 'twrp-12.1'
type: string
device_tree:
description: 'Device tree repository URL'
required: false
default: ''
type: string
device_tree_branch:
description: 'Device tree branch'
required: false
default: ''
type: string
device_name:
description: 'Device codename'
required: false
default: ''
type: string
device_path:
description: 'Device path (e.g., device/manufacturer/codename)'
required: false
default: ''
type: string
makefile_name:
description: 'Makefile name (e.g., omni_codename)'
required: false
default: ''
type: string
build_target:
description: 'Build target'
required: false
default: 'recovery'
type: choice
options:
- recovery
- boot
- vendorboot
upload_releases:
description: 'Upload releases'
required: true
default: 'false'
type: boolean
[Redacted Person]:
description: 'Mark as prerelease'
required: true
default: 'true'
type: boolean
jobs:
build:
name: Build TWRP
runs-on: ubuntu-20.04
permissions:
contents: write
env:
MANIFEST_BRANCH: ${{ github.event.inputs.manifest_branch || 'twrp-12.1' }}
DEVICE_TREE: ${{ github.event.inputs.device_tree || format('https://github.com/{0}', github.repository) }}
DEVICE_TREE_BRANCH: ${{ github.event.inputs.device_tree_branch || github.ref_name }}
DEVICE_NAME: ${{ github.event.inputs.device_name }}
DEVICE_PATH: ${{ github.event.inputs.device_path }}
MAKEFILE_NAME: ${{ github.event.inputs.makefile_name }}
BUILD_TARGET: ${{ github.event.inputs.build_target || 'recovery' }}
UPLOAD_RELEASES: ${{ github.event.inputs.upload_releases || 'false' }}
MARK_PRERELEASE: ${{ github.event.inputs.mark_prerelease || 'true' }}
steps:
- name: Clean Ubuntu
uses: rokibhasansagar/slimhub_actions@main
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 16
- name: Generate Build Info
id: build_info
run: |
echo "BUILD_DATE=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
echo "COMMIT_SHA=$(echo ${{ github.sha }} | [Redacted InternationalBankingAccountNumber]
- name: Build TWRP Recovery
uses: mlm-games/TWRP-recovery-build-action@main
with:
MANIFEST_BRANCH: ${{ env.MANIFEST_BRANCH }}
DEVICE_TREE: ${{ env.DEVICE_TREE }}
DEVICE_TREE_BRANCH: ${{ env.DEVICE_TREE_BRANCH }}
DEVICE_NAME: ${{ env.DEVICE_NAME }}
DEVICE_PATH: ${{ env.DEVICE_PATH }}
MAKEFILE_NAME: ${{ env.MAKEFILE_NAME }}
BUILD_TARGET: ${{ env.BUILD_TARGET }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: env.UPLOAD_RELEASES == 'false'
with:
name: TWRP-${{ env.BUILD_TARGET }}-${{ env.DEVICE_NAME || 'device' }}-${{ env.BUILD_DATE }}
path: |
${{ env.OUTPUT_DIR }}/*.img
${{ env.OUTPUT_DIR }}/*.tar
${{ env.OUTPUT_DIR }}/*vbmeta*
${{ env.OUTPUT_DIR }}/ramdisk-recovery.*
- name: Create Release
if: env.UPLOAD_RELEASES == 'true'
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.OUTPUT_DIR }}/*.img
${{ env.OUTPUT_DIR }}/*.tar
${{ env.OUTPUT_DIR }}/*vbmeta*
${{ env.OUTPUT_DIR }}/ramdisk-recovery.*
name: "TWRP ${{ env.BUILD_TARGET }} | ${{ env.DEVICE_NAME || 'device' }} | ${{ env.BUILD_DATE }}"
tag_name: ${{ env.DEVICE_NAME || 'build' }}-${{ env.BUILD_DATE }}
body: |
## TWRP Recovery Build
### Build Information
- **Date**: ${{ env.BUILD_DATE }}
- **Device**: ${{ env.DEVICE_NAME || 'Auto-detected' }}
- **Target**: ${{ env.BUILD_TARGET }}
- **Branch**: ${{ env.DEVICE_TREE_BRANCH }}
- **Commit**: ${{ env.COMMIT_SHA }}
### MD5 Checksums
```
${{ env.MD5_IMG }} recovery.img
```
### Notes
- Unofficial build
- Please backup before flashing
- Flash at your own risk
prerelease: ${{ env.MARK_PRERELEASE }}
continue-on-error: true
Key features of this workflow:
Flexible Inputs : All inputs from action.yml are available as workflow_dispatch inputs
Smart Defaults :
Uses TWRP 12.1 by default
Uses current repository as device tree if not specified
Uses current branch as device tree branch if not specified
Uses 'recovery' as default build target
Auto-detection :
If DEVICE_NAME, DEVICE_PATH, and MAKEFILE_NAME are not provided, they will be auto-detected from the device tree
Artifacts and Releases :
Always uploads build artifacts
Optionally creates GitHub releases
Includes all relevant files (img, tar, vbmeta, ramdisk)
Generates meaningful names with timestamps
Environment Setup :
Uses Ubuntu 20.04 as recommended for TWRP builds
Sets up 16GB swap space
Cleans the environment before building
This workflow should work out of the box for most TWRP 12.1 device trees. Users can either:
Just push their device tree and let auto-detection work
Use workflow_dispatch to customize any parameter
Fork and modify the workflow file to set specific defaults
The workflow handles both automated builds (on push/PR) and manual builds (through workflow_dispatch) with different options for each case.