Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/bazel-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ jobs:
} >> "$GITHUB_ENV"

# A module that is not in a registry, pinned by the commit in its
# git_override, moves to the head of its remote's main branch: every
# module followed by commit is assumed to follow main.
# git_override, moves to the head of its remote's default branch.
- name: Update the ${{ matrix.module }} commit
if: matrix.kind == 'commit'
env:
Expand All @@ -244,13 +243,13 @@ jobs:
remote=$(override remote)
old=$(override commit)
[[ -n "$remote" && "$old" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::no git_override with a remote and a commit for $MODULE in MODULE.bazel"; exit 1; }
# --exit-code exits 2 when the remote has no such branch.
# --exit-code exits 2 when the remote has no HEAD.
status=0
heads=$(git ls-remote --exit-code "$remote" refs/heads/main) || status=$?
[ "$status" != 2 ] || { echo "::error::$remote, the remote of $MODULE, has no main branch"; exit 1; }
heads=$(git ls-remote --exit-code "$remote" HEAD) || status=$?
[ "$status" != 2 ] || { echo "::error::$remote, the remote of $MODULE, has no default branch"; exit 1; }
[ "$status" = 0 ] || { echo "::error::could not read the branches of $remote"; exit 1; }
new=$(cut -f1 <<< "$heads")
[[ "$new" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::unexpected head '$new' for main of $remote"; exit 1; }
[[ "$new" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::unexpected head '$new' for the default branch of $remote"; exit 1; }
sed -i -E '/module_name = "'"$MODULE"'"/,/^\)/ s/commit = "[0-9a-f]{40}"/commit = "'"$new"'"/' MODULE.bazel
{
echo "TITLE=Update $MODULE to ${new:0:7}"
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ request:
- `node-version`: the newest Node in the major version already in use that
the pinned rules_nodejs can fetch. It does nothing without rules_nodejs.
- `commits`: each `git_override` with a `commit` and a `remote`, moved to the
head of the remote's `main` branch, on its own branch
`bazel-updates/<module>`. Every module followed by commit is assumed to
follow `main`; a remote without one fails the job. It does nothing without
such a `git_override`.
head of the remote's default branch, on its own branch
`bazel-updates/<module>`. It does nothing without such a `git_override`.

Versions only move forwards. `MODULE.bazel.lock` is refreshed with
`bazel mod deps --lockfile_mode=update`. A branch that already holds the same
Expand Down