Skip to content

Update community

Update community #1895

# Copyright 2021 The Knative Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
## This file is auto-generated from actions/update-community/auto-apply.yaml
## by ./cmd/gen-actions
##
name: Update community
on:
schedule:
- cron: '0 1,13 * * 1-5' # 6am/pm Pacific on weekdays
workflow_dispatch:
inputs:
only-repo:
description: "Only autogenerate a single repo (exact match)?"
reason:
description: "Justification?"
required: true
jobs:
meta:
runs-on: ubuntu-latest
outputs:
includes: ${{ steps.load-matrix.outputs.includes }}
names: ${{ steps.load-matrix.outputs.names }}
steps:
- name: Check out knobots configuration
uses: actions/checkout@v4
- name: Calculate affected repos
id: load-matrix
uses: "./actions/calculate-matrix"
with:
action-name: community
only-repo: ${{ github.event.inputs.only-repo }}
apply-change:
name: "Apply Change" # TODO: from metadata?
needs: meta
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
name: ${{ fromJson(needs.meta.outputs.names) }}
include: ${{ fromJson(needs.meta.outputs.includes) }}
steps:
- name: Checkout config code
uses: actions/checkout@v4
with:
path: config
- name: Checkout ${{ matrix.name }} code
uses: actions/checkout@v4
with:
path: main
repository: ${{ matrix.name }}
- name: Checkout knative/community code
uses: actions/checkout@v4
with:
path: meta
repository: knative/community
# This is required because the branch setting might be empty (to infer a default), so
# after checkout we fetch what the checkout action decided to check out.
- name: Infer branch from checkout
id: inferbranch
run: |
cd main
echo "branch=$(git branch --show-current)" >> $GITHUB_OUTPUT
- name: Apply work
id: work
uses: "./config/actions/update-community"
with:
repo: ${{ matrix.name }}
organization: ${{ matrix.meta-organization }}
include: ${{ matrix.include }}
- name: Create Pull Request
id: cpr
if: ${{ env.create_pr == 'true' }}
uses: peter-evans/create-pull-request@v7
with:
# Who to look like
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
committer: "Knative Automation <[email protected]>"
author: "Knative Automation <[email protected]>"
# Where to stage the change
push-to-fork: ${{ matrix.fork }}
branch: auto-updates/update-community-${{ steps.inferbranch.outputs.branch }}
signoff: true
delete-branch: true
# What labels to add
labels: ${{ env.pr_labels }}
# Note this is hard-coded based on the added repos in main.go
path: main
commit-message: |
Update community files
${{ steps.work.outputs.log }}
title: "[${{ steps.inferbranch.outputs.branch }}] Update community files"
body: |
${{ github.event.inputs.reason || 'Cron' }} -${{ github.actor }}
Produced by: ${{ github.repository }}/actions/update-community
Details:
```
${{ steps.work.outputs.log }}
```
- name: Report error
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() }}
env:
SLACK_ICON: http://github.com/knative-automation.png?size=48
SLACK_USERNAME: knative-automation
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ matrix.channel }}
SLACK_COLOR: '#8E1600'
MSG_MINIMAL: 'true'
SLACK_TITLE: "[${{ steps.inferbranch.outputs.branch }}] Update community files for ${{ matrix.name }} failed."
SLACK_MESSAGE: |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ github.event.inputs.reason || 'Cron' }} -${{ github.actor }}