• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15on:
16  workflow_dispatch:
17  schedule:
18  # every hour
19  - cron: '0 * * * *'
20name: owlbot_lock_update
21jobs:
22  update:
23    # ubuntu-22.04 has gcloud command
24    # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#cli-tools
25    runs-on: ubuntu-22.04
26    if: github.repository_owner == 'googleapis'
27    steps:
28    - uses: actions/checkout@v2
29    - name: Replace sha256 value in OwlBot to the latest value
30      shell: bash
31      run: |
32        # https://cloud.google.com/kubernetes-engine/docs/archive/using-container-images#container_registry
33        sha256=$(curl -s -I -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
34            "https://gcr.io/v2/cloud-devrel-public-resources/owlbot-java/manifests/latest" \
35            |grep -i docker-content-digest | awk '{print $2}' | tr -d '\r')
36        echo "The latest sha256 is ${sha256}"
37        sed -i.bak -e "s/digest: sha256.*/digest: ${sha256}/" .github/.OwlBot.lock.yaml
38        rm .github/.OwlBot.lock.yaml.bak
39    - uses: googleapis/code-suggester@v4
40      env:
41        ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
42      with:
43        command: pr
44        upstream_owner: googleapis
45        upstream_repo: google-cloud-java
46        description: 'Updating OwlBot.lock sha256 value to the latest'
47        title: 'chore: updating OwlBot.lock sha256 value to the latest'
48        message: 'chore: updating OwlBot.lock sha256 value to the latest'
49        branch: update-owlbot-lock
50        primary: main
51        force: true
52        git_dir: '.'
53