-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 2.12 KB
/
Copy pathsync-mirror.yml
File metadata and controls
60 lines (51 loc) · 2.12 KB
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
59
60
name: "Sync linux-6.6 from Gitee"
# Keep the linux-6.6 branch in sync with the upstream Phytium kernel on Gitee.
# The heavy clone/push runs on GitHub's runners, not a maintainer's machine.
on:
schedule:
- cron: "17 4 * * *" # daily, 04:17 UTC
workflow_dispatch:
permissions:
contents: write
concurrency:
group: sync-mirror
cancel-in-progress: false
env:
UPSTREAM: "https://gitee.com/phytium_embedded/phytium-linux-kernel.git"
BRANCH: "linux-6.6"
jobs:
sync:
if: ${{ github.repository_owner == 'armbian' }}
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: "Mirror ${{ env.BRANCH }} from upstream"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# Bare, single-branch clone of just the branch we mirror (full history).
git clone --bare --single-branch --branch "${BRANCH}" "${UPSTREAM}" repo.git
cd repo.git
# Force-update only refs/heads/<BRANCH> on this repo. No --mirror / --prune,
# so the default 'armbian-mirror' branch (and this workflow) is left untouched.
git push --force \
"https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
"refs/heads/${BRANCH}:refs/heads/${BRANCH}"
echo "Mirrored ${BRANCH}: $(git rev-parse "${BRANCH}")" >> "$GITHUB_STEP_SUMMARY"
# GitHub disables a repository's scheduled workflows after 60 days without
# activity, and the only thing that happens here is this workflow pushing with
# GITHUB_TOKEN - which does not count. Left alone the daily sync switches
# itself off and the mirror silently goes stale, taking phytium kernel builds
# with it. This re-arms the schedule on every run, the same way
# armbian/docker-armbian-build does.
keepalive:
if: ${{ github.repository_owner == 'armbian' }}
name: Keep Alive
needs: sync
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: liskin/gh-workflow-keepalive@f72ff1a1336129f29bf0166c0fd0ca6cf1bcb38c # v1.2.1