Changes for page Create Automatically Updating Repo in GitHub
Last modified by chrisby on 2025/04/22 14:54
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,3 +1,8 @@ 1 +### Use Case 2 + 3 +* Private GitHub repo, with other private repositories as dependencies 4 +* Need for fully automated dependency updates, including testing and merging them to main branch 5 + 1 1 ### GitHub Actions 2 2 3 3 The GitHub actions are used for CI purposes. One job is auto update, which can be enabled as follows: ... ... @@ -36,54 +36,52 @@ 36 36 37 37 This is a sample file how the weekly updates can be conducted via GitHub Actions. Create `.github/workflows/weekly-update.yml`: 38 38 39 -```none 40 -name: Weekly Update 44 + name: Weekly Update 45 + 46 + on: 47 + schedule: 48 + - cron: '0 2 * * 3' 49 + workflow_dispatch: 50 + 51 + permissions: 52 + contents: write 53 + pull-requests: write 54 + 55 + jobs: 56 + weekly-update: 57 + runs-on: ubuntu-latest 58 + steps: 59 + - uses: actions/checkout@v4 60 + 61 + - uses: ./.github/actions/setup 62 + 63 + - name: Run ci-runner update 64 + run: | 65 + go get -u ./... 66 + go mod tidy 67 + go build 68 + # execute the test suite to check whether the updates did not break anything 69 + 70 + - name: Commit and create PR 71 + id: cpr 72 + uses: peter-evans/create-pull-request@v5 73 + with: 74 + commit-message: "chore: weekly ci-runner update" 75 + branch: weekly/ci-update 76 + title: "Weekly CI Runner Update" 77 + delete-branch: true 78 + token: ${{ secrets.GITHUB_TOKEN }} 79 + 80 + - name: Enable Auto-Merge 81 + if: steps.cpr.outputs.pull-request-operation == 'created' 82 + uses: peter-evans/enable-pull-request-automerge@v3 83 + with: 84 + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} 85 + merge-method: squash 41 41 42 -on: 43 - schedule: 44 - - cron: '0 2 * * 3' 45 - workflow_dispatch: 87 +### Git Configuration 46 46 47 -permissions: 48 - contents: write 49 - pull-requests: write 89 +On your local PC, you need to tell the SDK to use SSH instead of HTTPS to get access. 50 50 51 -jobs: 52 - weekly-update: 53 - runs-on: ubuntu-latest 54 - steps: 55 - - uses: actions/checkout@v4 56 - 57 - - uses: ./.github/actions/setup 58 - 59 - - name: Run ci-runner update 60 - run: | 61 - go get -u ./... 62 - go mod tidy 63 - go build 64 - # execute the test suite to check whether the updates did not break anything 65 - 66 - - name: Commit and create PR 67 - id: cpr 68 - uses: peter-evans/create-pull-request@v5 69 - with: 70 - commit-message: "chore: weekly ci-runner update" 71 - branch: weekly/ci-update 72 - title: "Weekly CI Runner Update" 73 - delete-branch: true 74 - token: ${{ secrets.GITHUB_TOKEN }} 75 - 76 - - name: Enable Auto-Merge 77 - if: steps.cpr.outputs.pull-request-operation == 'created' 78 - uses: peter-evans/enable-pull-request-automerge@v3 79 - with: 80 - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} 81 - merge-method: squash 82 -``` 83 - 84 -### Private Go Repository Dependency 85 - 86 -If you are developing with Go and need a private repository as a dependency, you need to tell the SDK to use SSH instead of HTTPS to get access. 87 - 88 88 git config --global url."ssh://git@github.com/".insteadOf "https://github.com/" 89 89 go env -w GOPRIVATE=github.com/ocelot-cloud/*