diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 00c2dfb..15daccb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,9 +2,11 @@ version: 2 updates: - package-ecosystem: pip directory: / + target-branch: develop schedule: interval: weekly - package-ecosystem: github-actions directory: / + target-branch: develop schedule: interval: weekly diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 1c3e6d8..2988e43 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -1,7 +1,13 @@ name: Update submodules -# Moves each submodule to the tip of the branch set in .gitmodules and commits -# the new pointers to develop. +# Moves each submodule to the tip of the branch set in .gitmodules and opens a +# pull request against develop. The pull request build checks that the new source +# still builds and that the documented examples still hold; nothing is pushed to +# develop or main. +# A push or a pull request made with the workflow token does not start the +# pull request workflows. workflow_dispatch is the documented exception, so the +# checks are started on the branch by hand below; their results show on the +# pull request. on: schedule: @@ -9,7 +15,9 @@ on: workflow_dispatch: {} permissions: + actions: write contents: write + pull-requests: write concurrency: group: update-submodules @@ -38,7 +46,9 @@ jobs: git checkout -B "$branch" FETCH_HEAD ' - - name: Commit to develop + - name: Open or update the pull request + env: + GH_TOKEN: ${{ github.token }} run: | if git diff --quiet; then echo "No submodule updates." @@ -46,6 +56,17 @@ jobs: fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git switch -C chore/update-submodules git add -A git commit -m "chore: update submodules to latest tracked branches" - git push origin HEAD:develop + git push --force-with-lease origin chore/update-submodules + if [ -z "$(gh pr list --head chore/update-submodules --state open --json number --jq '.[].number')" ]; then + gh pr create --base develop --head chore/update-submodules \ + --title "chore: update submodules to latest tracked branches" \ + --body "Moves each submodule to the tip of the branch set in .gitmodules." + fi + for workflow in docs-build.yml examples.yml; do + if [ -f ".github/workflows/$workflow" ]; then + gh workflow run "$workflow" --ref chore/update-submodules + fi + done diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 11a9341..b832b5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ The standard for this site is the `docs-site` plugin of [CompMetEng/skills](http ## Branches -`develop` is the default branch. It documents the `develop` branches of RAVEN and raven-toolbox, which the submodules track, and a daily workflow moves the submodule pointers to their tips. Pull requests target `develop`. `main` documents the released versions: a release of RAVEN and raven-toolbox is followed by a pull request from `develop` to `main` that is merged with a merge commit and pins the submodules to the released commits. +`develop` is the integration branch. It documents the `develop` branches of RAVEN and raven-toolbox, which the submodules track, and a daily workflow opens a pull request against `develop` that moves the submodule pointers to their tips. Pull requests target `develop`. `main` documents the released versions: a release of RAVEN and raven-toolbox is followed by a pull request from `develop` to `main` that is merged with a merge commit and pins the submodules to the released commits. ## Building and checking