-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (59 loc) · 2.86 KB
/
Copy pathfoss-sync.yml
File metadata and controls
64 lines (59 loc) · 2.86 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
61
62
63
64
name: PostHog FOSS Sync
on:
push:
branches:
- master
- main
concurrency:
group: foss-sync
cancel-in-progress: false
jobs:
repo-sync:
name: Sync posthog-foss with posthog
if: github.repository == 'PostHog/posthog'
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Get app token
id: app-token
uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3.0.0
with:
app_id: ${{ secrets.GH_APP_POSTHOG_FOSS_SYNC_APP_ID }}
private_key: ${{ secrets.GH_APP_POSTHOG_FOSS_SYNC_PRIVATE_KEY }}
- name: Sync repositories 1 to 1 - master branch
uses: PostHog/git-sync@29d9a6756e8646d0715d5caa9c66438be7e32a1f # v3
with:
source_repo: 'https://x-access-token:${{ github.token }}@github.com/posthog/posthog.git'
source_branch: 'master'
destination_repo: 'https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/posthog/posthog-foss.git'
destination_branch: 'master'
- name: Sync repositories 1 to 1 – tags
uses: PostHog/git-sync@29d9a6756e8646d0715d5caa9c66438be7e32a1f # v3
with:
source_repo: 'https://x-access-token:${{ github.token }}@github.com/posthog/posthog.git'
source_branch: 'refs/tags/*'
destination_repo: 'https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/posthog/posthog-foss.git'
destination_branch: 'refs/tags/*'
- name: Checkout posthog-foss
uses: actions/checkout@v6
with:
repository: 'posthog/posthog-foss'
ref: master
token: ${{ steps.app-token.outputs.token }}
- name: Change LICENSE to pure MIT
run: |
sed -i -e '/PostHog Inc\./,/Permission is hereby granted/c\Copyright (c) 2020-2021 PostHog Inc\.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy' LICENSE
echo -e "MIT License\n\n$(cat LICENSE)" > LICENSE
- name: Remove unused GitHub workflows
run: |
cd .github/workflows
ls | grep -v foss-release-image-publish.yml | xargs rm
- name: Commit "Sync and remove all non-FOSS parts"
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
message: 'Sync and remove all non-FOSS parts'
remove: '["-r ee/ .github/dependabot.yml"]'
default_author: github_actions
github_token: ${{ steps.app-token.outputs.token }}