sync-neo.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: Sync neo subtree
  2. on:
  3. push:
  4. branches:
  5. - master
  6. # paths:
  7. # - 'neo/**'
  8. permissions:
  9. contents: read
  10. jobs:
  11. sync:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v4
  16. with:
  17. fetch-depth: 0
  18. # Default persist-credentials leaves GITHUB_TOKEN in
  19. # http.https://github.com/.extraheader. Git sends that Authorization
  20. # header on every github.com request, including the neo push. This
  21. # job's token cannot see private unacms/neo, so GitHub answers
  22. # "Repository not found".
  23. persist-credentials: false
  24. - name: Push neo subtree
  25. env:
  26. NEO_REPO_TOKEN: ${{ secrets.NEO_REPO_TOKEN }}
  27. run: |
  28. # Checkout writes the header into .git/config (v4.4.0). Newer
  29. # checkout releases may keep it in an included credentials file;
  30. # persist-credentials: false makes checkout delete both. Unset the
  31. # local key as well so a leftover header cannot override the URL.
  32. git config --local --unset-all http.https://github.com/.extraheader || true
  33. git remote add neo \
  34. "https://x-access-token:${NEO_REPO_TOKEN}@github.com/unacms/neo.git"
  35. git subtree push --prefix neo neo main