| # This workflow creates a new PR with the updated build ids for Playground prebuilts. |
| # To run it, navigate to https://github.com/androidx/androidx/actions/workflows/update_prebuilts.yml |
| # and click "Run workflow" |
| name: Update Prebuilts |
| on: |
| workflow_dispatch: |
| inputs: |
| target-branch: |
| description: 'The target branch for the PR' |
| required: false |
| default: 'androidx-main' |
| type: string |
| comment: |
| description: 'Any comment you would like to add to the PR body' |
| required: false |
| default: '' |
| type: string |
| jobs: |
| update-prebuilts: |
| runs-on: ubuntu-latest |
| steps: |
| - name: "Checkout androidx repo" |
| uses: actions/checkout@v4 |
| - name: "Run update prebuilt snapshot ids script" |
| shell: bash |
| # this does not update metalava because it needs to match the |
| # metalava buildId used by androidx |
| run: development/update_playground.sh |
| - name: "Check if anything changed" |
| shell: bash |
| id: "check-for-changes" |
| run: | |
| set -x |
| git status |
| HAS_CHANGES=`git status --porcelain|grep playground\.properties|wc -l` |
| echo "has_changes=$HAS_CHANGES" >> $GITHUB_OUTPUT |
| - name: "Create a PR" |
| shell: bash |
| id: "create-pr" |
| if: ${{ steps.check-for-changes.outputs.has_changes >= 1 }} |
| run: | |
| set -x |
| BRANCH_NAME="ci-workflow-bot/update-prebuilts-$(date "+%Y-%m-%d-%H-%M")/${{ github.run_id }}-${{ github.run_number }}" |
| git config user.email "[email protected]" |
| git config user.name "AndroidX Github Bot" |
| git checkout -b $BRANCH_NAME |
| git add playground-common/playground.properties |
| git commit -m "Update playground snapshot ids" # PR body overrides this commit message |
| git push origin $BRANCH_NAME |
| # create pull request |
| gh pr create --base ${{ github.event.inputs.target-branch || 'androidx-main' }} \ |
| --title "[AndroidX Github Bot] Update playground snapshot ids" \ |
| --body "This CL was created by the update_prebuilts workflow. |
| ${{ github.event.inputs.comment || '' }} |
| Bug: n/a |
| Test: CI" |
| env: |
| GITHUB_TOKEN: ${{ secrets.ANDROIDX_GITHUB_BOT_TOKEN }} |