Skip to content

Add workflow for automatic rebase.#16

Open
DaniilKl wants to merge 4 commits intomasterfrom
add-rebase-script
Open

Add workflow for automatic rebase.#16
DaniilKl wants to merge 4 commits intomasterfrom
add-rebase-script

Conversation

@DaniilKl
Copy link
Copy Markdown

@DaniilKl DaniilKl commented Apr 9, 2026

No description provided.

@DaniilKl DaniilKl self-assigned this Apr 9, 2026
@DaniilKl
Copy link
Copy Markdown
Author

DaniilKl commented Apr 9, 2026

I am not sure why the actions launched the rebase.sh. This workflow is set up to be launched only when called by another workflow 😕 .

@DaniilKl DaniilKl force-pushed the add-rebase-script branch 2 times, most recently from 427cb2b to 5eae06d Compare April 9, 2026 09:30
@DaniilKl
Copy link
Copy Markdown
Author

DaniilKl commented Apr 9, 2026

I am not sure why the actions launched the rebase.sh. This workflow is set up to be launched only when called by another workflow 😕 .

It seems it was just an automatic check of the correctness of the rebase.yml, not the actual execution of the rebase.yml.

@DaniilKl DaniilKl force-pushed the add-rebase-script branch 7 times, most recently from 4437fe8 to 94a562f Compare April 10, 2026 09:14
@DaniilKl DaniilKl marked this pull request as ready for review April 10, 2026 09:29
@DaniilKl DaniilKl requested a review from macpijan April 10, 2026 09:29
Comment thread .github/workflows/rebase.yml Outdated
@DaniilKl
Copy link
Copy Markdown
Author

I will have to add a few diagrams here, hence, switching to draft.

@DaniilKl DaniilKl marked this pull request as draft April 13, 2026 14:49
@DaniilKl DaniilKl force-pushed the add-rebase-script branch 5 times, most recently from ed03c87 to 55245e6 Compare April 15, 2026 13:27
Signed-off-by: Danil Klimuk <daniil.klimuk@3mdeb.com>
woodpecker-cli

Signed-off-by: Danil Klimuk <daniil.klimuk@3mdeb.com>
Signed-off-by: Danil Klimuk <daniil.klimuk@3mdeb.com>
This is because it is being used in other TrenchBoot repos as well but
on other branches because of:

TrenchBoot/grub#32
TrenchBoot/qubes-antievilmaid#15
TrenchBoot/xen#26

IMHO there is no reason to mention every use of this workflow.

Signed-off-by: Danil Klimuk <daniil.klimuk@3mdeb.com>
@DaniilKl DaniilKl force-pushed the add-rebase-script branch from 55245e6 to 0de7bf6 Compare April 15, 2026 13:33
@DaniilKl
Copy link
Copy Markdown
Author

DaniilKl commented Apr 15, 2026

I will have to add a few diagrams here, hence, switching to draft.

Moving to "Ready for review" now, I will consider adding the diagrams to TrenchBoot docs instead, as the diagrams will describe an entire CI/CD infrastructure for automatic rebasing in TrenchBoot organization.

This seems to be a good place: https://trenchboot.org/dev-docs/ .

Comment thread scripts/rebase.sh
Comment on lines +395 to +396
commits1_num=$(printf '%s' "$commits1" | wc -l)
commits2_num=$(printf '%s' "$commits2" | wc -l)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return 0 for both 0 and 1 commit

Comment thread scripts/rebase.sh
if [[ "$BRANCH" != "$CONFLICT_BRANCH" ]]; then
git branch "$CONFLICT_BRANCH" &> /dev/null
if [[ "$LOCAL" != "true" && -n "$TOKEN" ]]; then
push_branch_remote "$TOKEN" "$CONFLICT_BRANCH" "$FIRST_REPO_REMOTE_NAME" || exit 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think || exit 1 is unneeded with set -e

Comment thread scripts/rebase.sh

# The remote URL must contain the token for the ref to be modified on the
# remote via personal access token authentication:
git remote get-url "$remote" 2> /dev/null | grep -F "$token" &> /dev/null || return 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails, how do we debug it? I have same issue in other places where you hide logs with &>/dev/null.


# Download woodpecker-cli and register cleanup on exit:
download_woodpecker_cli "$WOODPECKER_CLI_VERSION"
trap cleanup EXIT
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a first instruction

# versions.
WOODPECKER_CLI_VERSION="${WOODPECKER_CLI_VERSION:-3.13.0}"
WP_BIN=""
WP_TMPDIR=""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep everything together? E.g. function definitions first, then variables, then code. It's too easy to miss something between functions otherwise, especially in longer scripts

Comment thread scripts/rebase.sh
Comment on lines +446 to +447
SUCCESSULL_REBASE_PR_TITLE="Automatic rebase of branch $FIRST_REPO_BRANCH completed successfuly"
SUCCESSULL_REBASE_MESSAGE="
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo (should be successful)

Comment thread scripts/rebase.sh
result="$(python3 -c "import sys, json; print(len(json.load(sys.stdin)))" <<< "$response")"
fi

if [ $result -eq 0 ]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ $result -eq 0 ]; then
if [ "$result" -eq 0 ]; then

Comment on lines +165 to +168
-w|--workflow)
WORKFLOW="$2"
shift 2
;;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

API_URL=""
OWNER=""
REPO=""
WORKFLOW=""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

with:
repository: TrenchBoot/.github
path: shared
ref: master
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you want the same ref as this workflow was called with?

specified multiple times.

Environment variables:
WOODPECKER_CLI_VERSION woodpecker-cli version to download (default: 2.7.0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WOODPECKER_CLI_VERSION woodpecker-cli version to download (default: 2.7.0)
WOODPECKER_CLI_VERSION woodpecker-cli version to download (default: 3.13.0)

@@ -0,0 +1,170 @@
#!/bin/bash
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used by anyone or just for local dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants