forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 2.28 KB
/
update_prebuilts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 }}