|
| 1 | +# Cre: https://github.com/orgs/community/discussions/153608#discussioncomment-12453674 |
| 2 | +name: Sync Fork with Upstream |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 * * *" # Runs daily at midnight UTC |
| 6 | + workflow_dispatch: # Allows manual triggering |
1 | 7 |
|
| 8 | +jobs: |
| 9 | + sync: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Configure Git |
| 13 | + run: | |
| 14 | + git config --global user.email "994931+Zarloc@users.noreply.github.com" |
| 15 | + git config --global user.name "Zarloc" |
| 16 | +
|
| 17 | + - name: Checkout Forked Repository |
| 18 | + uses: actions/checkout@v6 |
| 19 | + with: |
| 20 | + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Sync Upstream & Apply Patch |
| 24 | + run: | |
| 25 | + # 1. Fetch Upstream |
| 26 | + git remote add upstream https://github.com/netdata/netdata.git |
| 27 | + git fetch upstream master |
| 28 | +
|
| 29 | + # 2. Hard Reset: Wipe local history to match Upstream exactly |
| 30 | + # This removes yesterday's patch commit so we don't get conflicts |
| 31 | + git checkout master |
| 32 | + git reset --hard upstream/master |
| 33 | +
|
| 34 | + # 3. Apply the Hack (sed) |
| 35 | + echo "Applying auth bypass patch..." |
| 36 | + sed -i 's/return ((user & endpoint) == endpoint);/return true;/' src/web/api/http_auth.h |
| 37 | + |
| 38 | + # 4. Add this file |
| 39 | + echo "${SYNC_UPSTREAM}" > .github/workflows/sync-upstream.yml |
| 40 | +
|
| 41 | + # 5. Commit the changes |
| 42 | + git add src/web/api/http_auth.h |
| 43 | + git add .github/workflows/sync-upstream.yml |
| 44 | + git commit -m "feat: bypass Netdata Cloud sign-in which is required to access dashboard features" |
| 45 | +
|
| 46 | + # 6. Force Push |
| 47 | + # We force push because we rewrote history (replaced yesterday's commit with today's) |
| 48 | + git push origin master --force |
0 commit comments