Skip to content

repo-sync

repo-sync #211

Workflow file for this run

# Copyright 2020 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.
name: repo-sync
on:
schedule:
- cron: '0 18 * * 3' # Runs at 18:00 UTC (11am Pacific) on Wed
workflow_dispatch: # Manual trigger.
jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- name: repo-sync
uses: wei/git-sync@v2
if: ${{ github.repository != 'knative-extensions/.github' }}
with:
source_repo: "https://github.com/knative-extensions/.github.git"
source_branch: "main"
destination_repo: "https://x-access-token:${{ secrets.SYNC_TOKEN || github.token }}@github.com/${{ github.repository }}.git"
destination_branch: "main"
- name: setup env for slack
run: |
if [[ "${{ secrets.SLACK_WEBHOOK }}" != "" ]]; then
echo "SLACK_WEBHOOK=exists" >> $GITHUB_ENV
fi
- name: Post failures to Slack
# Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block.
if: env.SLACK_WEBHOOK != '' && failure()
uses: rtCamp/action-slack-notify@v2.1.0
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: github-actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: 'true'
SLACK_MESSAGE: |
Repo sync failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}