Environment Config Diff & Propagate for Android Builds
This workflow automatically detects changes in the .env.staging file in a GitHub repository and keeps Android configuration files (build.gradle and gradle.properties) in sync.It creates a new Git branch, applies updates safely, opens a pull request and notifies the team on Slack — all without manual effort.
Whenever .env.staging changes:
- The workflow detects the change via GitHub webhook
- Compares ENV values with Android config files
- Automatically updates build.gradle and gradle.properties
- Creates a new Git branch
- Opens a pull request
- Sends a Slack notification
You get:
- Automatic Android config synchronization
- Safe updates via pull requests
- Zero manual copying of ENV values
- Instant Slack visibility for the team
Ideal for teams managing Android app configuration across environments without mistakes.
What It Does
This workflow automates Android configuration updates end-to-end:
- Listens for GitHub push events.
- Checks if .env.staging was modified.
- Stops execution if ENV file was not changed.
- Fetches .env.staging and gradle.properties from main.
- Converts both files into easy-to-compare key-value pairs.
- Compares ENV values against Gradle values.
- Creates a new Git branch for changes.
- Fetches files from the new branch.
- Identifies which variables must be updated.
- Applies ENV values to:
* build.gradle
* gradle.properties
- Commits the changes.
- Creates a pull request.
- Sends a Slack notification with PR details.
This ensures Android configs are always aligned with ENV files.
Who’s It For
This workflow is ideal for:
- Android development teams
- DevOps & platform engineers
- CI/CD automation teams
- Teams managing multiple environments (staging / prod)
- Organizations avoiding manual config drift
- Anyone tired of copy-pasting ENV values
Requirements to Use This Workflow
To run this workflow, you need:
- n8n instance (cloud or self-hosted)
- GitHub repository with:
- .env.staging
- app/build.gradle
- gradle.properties
- GitHub Personal Access Token
- Slack workspace + API credentials
- Basic understanding of Android config files
How It Works
- GitHub Webhook TriggerListens for commits pushed to the repository.
- ENV Change CheckWorkflow continues only if .env.staging changed.
- Fetch & Parse FilesReads ENV and Gradle files and converts them into key-value format.
- Compare Config ValuesFinds missing or mismatched variables.
- Create Safe BranchGenerates a timestamp-based branch from main.
- Apply UpdatesUpdates only the required values in:
- build.gradle
- gradle.properties
- Commit ChangesSaves updates to the new branch.
- Create Pull RequestOpens a PR for review.
- Notify SlackSends PR link and details to the team.
Setup Steps
- Import the provided n8n workflow JSON.
- Configure GitHub credentials in all GitHub & HTTP nodes.
- Set your repository name and owner.
- Configure Slack credentials and select a channel.
- Ensure .env.staging exists in your repo.
- Activate the workflow.
- Push a change to .env.staging — automation starts instantly
How To Customize Nodes
Customize ENV File
- Replace .env.staging with .env.production or others.
- Update filename in GitHub fetch + check nodes.
Customize Android Files
- Extend logic to include:
- local.properties
- BuildConfig.kt
- settings.gradle
Customize Branch Naming
- Modify the Generate New Branch Name node.
- Add environment names or commit IDs.
Customize Slack Message
You can add:
- Emojis
- PR author name
- Changed variable list
- Mentions (@team, @android)
Add-Ons (Optional Enhancements)
You can extend this workflow to:
- Support multiple ENV files
- Add approval checks before PR creation
- Auto-merge after approval
- Validate ENV variable formats
- Send diff summary to Slack
- Block secrets from being committed
- Add Jira / Linear ticket creation
- Trigger Android CI build after PR creation
Use Case Examples
1. Environment Sync
Keep Android configs aligned with staging ENV automatically.
2. CI/CD Safety
Prevent broken builds due to mismatched config values.
3. Team Transparency
Everyone sees config updates via Slack + PRs.
4. DevOps Automation
Remove repetitive manual config updates.
5. Audit Friendly
All changes tracked through Git history & PRs.
Troubleshooting Guide
| Issue |
Possible Cause |
Solution |
| Workflow not triggered |
Webhook not configured |
Re-register GitHub webhook |
| No PR created |
.env.staging not changed |
Ensure the file is modified |
| Wrong values updated |
Parsing logic issue |
Check KEY=VALUE format |
| Slack message not sent |
Invalid credentials |
Reconnect Slack API |
| Commit failed |
Missing permissions |
Check GitHub token scopes |
Need Help?
If you need help extending or customizing this workflow, adding production support, CI integrations, security checks or enterprise-scale automation, then our n8n workflow development team at WeblineIndia can help you build robust, production-ready workflows.