|
| 1 | +name: Check AOSP Updates |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 9 * * 1' # Every Monday at 9:00 UTC |
| 6 | + workflow_dispatch: # Allow manual triggering |
| 7 | + |
| 8 | +jobs: |
| 9 | + check-updates: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + timeout-minutes: 60 |
| 12 | + permissions: |
| 13 | + contents: write |
| 14 | + pull-requests: write |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + submodules: true |
| 19 | + fetch-depth: 1 |
| 20 | + |
| 21 | + - uses: actions/setup-go@v5 |
| 22 | + with: |
| 23 | + go-version: '1.25.x' |
| 24 | + |
| 25 | + - name: Regenerate version tables from AOSP tags |
| 26 | + run: make genversions |
| 27 | + |
| 28 | + - name: Regenerate code |
| 29 | + run: | |
| 30 | + make clean |
| 31 | + make generate |
| 32 | + make genaidlcli |
| 33 | + make smoke |
| 34 | + make readme |
| 35 | +
|
| 36 | + - name: Check for changes |
| 37 | + id: changes |
| 38 | + run: | |
| 39 | + UNTRACKED=$(git ls-files --others --exclude-standard) |
| 40 | + if git diff --quiet && [ -z "$UNTRACKED" ]; then |
| 41 | + echo "changed=false" >> "$GITHUB_OUTPUT" |
| 42 | + else |
| 43 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Create or update pull request |
| 47 | + if: steps.changes.outputs.changed == 'true' |
| 48 | + env: |
| 49 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + run: | |
| 51 | + git config user.name "github-actions[bot]" |
| 52 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 53 | +
|
| 54 | + BRANCH="automated/aosp-update" |
| 55 | + git checkout -b "$BRANCH" |
| 56 | + git add -A |
| 57 | + git commit -m "$(cat <<'EOF' |
| 58 | + Update AOSP version tables and generated code |
| 59 | +
|
| 60 | + Automated weekly check found new AOSP revision tags. |
| 61 | + EOF |
| 62 | + )" |
| 63 | + git push --force -u origin "$BRANCH" |
| 64 | +
|
| 65 | + # Create PR only if one doesn't already exist for this branch. |
| 66 | + EXISTING_PR=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || true) |
| 67 | + if [ -n "$EXISTING_PR" ]; then |
| 68 | + echo "PR #$EXISTING_PR already exists and has been updated." |
| 69 | + else |
| 70 | + gh pr create \ |
| 71 | + --title "Update AOSP generated code" \ |
| 72 | + --body "$(cat <<'EOF' |
| 73 | + ## Summary |
| 74 | +
|
| 75 | + Automated weekly check detected new AOSP revision tags. This PR updates: |
| 76 | +
|
| 77 | + - Version transaction code tables (`binder/versionaware/codes_gen.go`) |
| 78 | + - Generated AIDL proxy code |
| 79 | + - E2E smoke tests |
| 80 | + - README package statistics |
| 81 | +
|
| 82 | + ## Test plan |
| 83 | +
|
| 84 | + - [ ] CI passes (unit tests, vet, build, check-generated) |
| 85 | + - [ ] Review generated diff for unexpected changes |
| 86 | + EOF |
| 87 | + )" |
| 88 | + fi |
0 commit comments