Skip to content

Sync proxy

Sync proxy #28

Workflow file for this run

name: Sync proxy
on:
# Hourly
schedule:
- cron: "15 * * * *"
workflow_dispatch:
inputs:
version:
description: "The version of the proxy to sync"
required: true
default: "latest"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
meta:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
GH_REPO: ${{ vars.LINKERD2_PROXY_REPO || 'linkerd/linkerd2-proxy' }}
GH_TOKEN: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
steps:
- if: inputs.version == 'latest' || inputs.version == ''
id: latest
run: echo version="$(gh release view --json name -q .name)" >> "$GITHUB_OUTPUT"
outputs:
version: ${{ steps.latest.outputs.version || inputs.version }}
sync-proxy:
needs: meta
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
LINKERD2_PROXY_REPO: ${{ vars.LINKERD2_PROXY_REPO || 'linkerd/linkerd2-proxy' }}
VERSION: ${{ needs.meta.outputs.version }}
permissions:
checks: read
contents: write
pull-requests: write
repository-projects: read
steps:
- name: Configure git
env:
GITHUB_USERNAME: ${{ vars.LINKERD2_PROXY_GITHUB_USERNAME || 'github-actions[bot]' }}
run: |
git config --global --add safe.directory "$PWD" # actions/runner#2033
git config --global user.name "$GITHUB_USERNAME"
git config --global user.email "$GITHUB_USERNAME"@users.noreply.github.com
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
token: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
- id: changed
run: |
if [ "$(cat .proxy-version)" != "$VERSION" ]; then
echo changed=true >> "$GITHUB_OUTPUT"
fi
- if: steps.changed.outputs.changed == 'true'
run: |
set -eu
git fetch origin bot/sync-proxy/"$VERSION" || true
git switch -c bot/sync-proxy/"$VERSION"
EDITOR=true bin/git-commit-proxy-version "$VERSION"
git push origin bot/sync-proxy/"$VERSION"
- if: steps.changed.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.LINKERD2_PROXY_GITHUB_TOKEN || github.token }}
run: |
gh pr create \
--title "proxy: $VERSION" \
--body "Synced $VERSION from $LINKERD2_PROXY_REPO " \
--fill \
--label 'bot/sync-proxy'