Skip to content
Open
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
85 changes: 85 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Try rebasing on updated upstream, report in case of conflicts

on:
workflow_call:
secrets:
first-remote-token:
description: >
Personal access token for performing the following operations on the
downstream-repo: fetch the repository, create a branch, delete a
branch, create commits on a branch, push to a branch, open a PR, close
a PR, get list of PRs.
required: true
inputs:
downstream-repo:
description: >
<first_repo> parameter for the rebase.sh script.
required: true
type: string
downstream-branch:
description: >
<first_repo_branch> parameter for the rebase.sh script.
required: true
type: string
upstream-repo:
description: >
<second_repo> parameter for the rebase.sh script.
required: true
type: string
upstream-branch:
description: >
<second_repo_branch> parameter for the rebase.sh script.
required: true
type: string
commit-user-name:
description: >
NAME parameter for the --upstream-branch option of the rebase.sh
script.
required: true
type: string
commit-user-email:
description: >
EMAIL parameter for the --commit-user-email option of the rebase.sh
script.
required: true
type: string
cicd-trigger-resume:
description: >
MESSAGE parameter for the --cicd-trigger-resume option of the
rebase.sh script.
required: true
type: string

jobs:
build-and-package:
runs-on: ubuntu-latest
name: Try rebasing on updated upstream, report in case of conflicts
permissions:
# For creation/deletion/pushing to branches and creating PRs
contents: write
steps:
- uses: actions/checkout@v6
with:
repository: TrenchBoot/.github
path: shared
ref: add-rebase-script
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Suggested change
ref: add-rebase-script
ref: master

This change must be applied after all the testing is done.

- name: Run script for rebasing
env:
FIRST_REMOTE_TOKEN: ${{ secrets.first-remote-token }}
DOWNSTREAM_REPO: ${{ inputs.downstream-repo }}
DOWNSTREAM_BRANCH: ${{ inputs.downstream-branch }}
UPSTREAM_REPO: ${{ inputs.upstream-repo }}
UPSTREAM_BRANCH: ${{ inputs.upstream-branch }}
NAME: ${{ inputs.commit-user-name }}
EMAIL: ${{ inputs.commit-user-email }}
MESSAGE: ${{ inputs.cicd-trigger-resume }}
run: |
shared/scripts/rebase.sh --first-remote-token "$FIRST_REMOTE_TOKEN" \
--commit-user-name "$NAME" \
--commit-user-email "$EMAIL" \
--cicd-trigger-resume "$MESSAGE" \
"$DOWNSTREAM_REPO" \
"$DOWNSTREAM_BRANCH" \
"$UPSTREAM_REPO" \
"$UPSTREAM_BRANCH"
71 changes: 71 additions & 0 deletions .github/workflows/trigger-gitea-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Trigger a Gitea Actions workflow

on:
workflow_call:
inputs:
api-url:
description: >
Base URL of the Gitea instance, e.g. https://gitea.example.com.
--api-url parameter for the gitea_trigger.sh script.
required: true
type: string
owner:
description: >
Repository owner (user or organization).
--owner parameter for the gitea_trigger.sh script.
required: true
type: string
repo:
description: >
Repository name.
--repo parameter for the gitea_trigger.sh script.
required: true
type: string
workflow:
description: >
Workflow file name, e.g. ci.yaml.
--workflow parameter for the gitea_trigger.sh script.
required: true
type: string
ref:
description: >
Branch or tag to trigger the workflow on.
--ref parameter for the gitea_trigger.sh script.
required: false
type: string
default: 'main'
secrets:
gitea-token:
description: >
Gitea API token for triggering the workflow.
--token parameter for the gitea_trigger.sh script.
required: true

jobs:
trigger-gitea:
runs-on: ubuntu-latest
name: Trigger a Gitea Actions workflow
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
repository: TrenchBoot/.github
path: shared
ref: ${{ github.job_workflow_sha }}
- name: Trigger Gitea CI/CD workflow
env:
GITEA_TOKEN: ${{ secrets.gitea-token }}
GITEA_API_URL: ${{ inputs.api-url }}
GITEA_OWNER: ${{ inputs.owner }}
GITEA_REPO: ${{ inputs.repo }}
GITEA_WORKFLOW: ${{ inputs.workflow }}
GITEA_REF: ${{ inputs.ref }}
run: |
shared/scripts/gitea-trigger.sh \
--token "$GITEA_TOKEN" \
--api-url "$GITEA_API_URL" \
--owner "$GITEA_OWNER" \
--repo "$GITEA_REPO" \
--workflow "$GITEA_WORKFLOW" \
--ref "$GITEA_REF"
Loading