From 8c59ad2ab35aa1680917c261e0be7f1678e3ebca Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 4 Nov 2023 19:14:39 +0100 Subject: [PATCH] [FORGEJO] cascading PR to runner --- .forgejo/cascading-pr-runner | 18 ++++++++++++++++ .forgejo/workflows/cascade-runner.yml | 30 +++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 .forgejo/cascading-pr-runner create mode 100644 .forgejo/workflows/cascade-runner.yml diff --git a/.forgejo/cascading-pr-runner b/.forgejo/cascading-pr-runner new file mode 100755 index 0000000..bcb29c6 --- /dev/null +++ b/.forgejo/cascading-pr-runner @@ -0,0 +1,18 @@ +#!/bin/bash + +set -ex + +runner=$1 +runner_pr=$2 +act=$3 +act_pr=$4 + +url=$(jq --raw-output .head.repo.html_url < $act_pr) +test "$url" != null +url=${url##http*://} +branch=$(jq --raw-output .head.ref < $act_pr) +test "$branch" != null +cd $runner +sed -i -e "s|^replace github.com/nektos/act.*|replace github.com/nektos/act => $url $branch|" go.mod +GOPROXY=direct go mod tidy +date > last-upgrade diff --git a/.forgejo/workflows/cascade-runner.yml b/.forgejo/workflows/cascade-runner.yml new file mode 100644 index 0000000..6ee43ca --- /dev/null +++ b/.forgejo/workflows/cascade-runner.yml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: MIT +on: + pull_request_target: + types: + - opened + - synchronize + - closed +jobs: + cascade: + runs-on: docker + if: vars.CASCADE != 'no' + container: + image: 'docker.io/node:20-bookworm' + steps: + - uses: https://code.forgejo.org/actions/setup-go@v4 + with: + go-version: "1.21" + - uses: actions/cascading-pr@v1 + with: + origin-url: ${{ env.GITHUB_SERVER_URL }} + origin-repo: forgejo/act + origin-token: ${{ secrets.CASCADING_PR_ORIGIN }} + origin-pr: ${{ github.event.pull_request.number }} + destination-url: ${{ env.GITHUB_SERVER_URL }} + destination-repo: forgejo/runner + destination-fork-repo: cascading-pr/runner + destination-branch: main + destination-token: ${{ secrets.CASCADING_PR_DESTINATION }} + close-merge: true + update: .forgejo/cascading-pr-runner diff --git a/README.md b/README.md index 99e898e..b74d63a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Forking rules -This is a custom fork of [nektos/act](https://github.com/nektos/act/), for the purpose of serving [act_runner](https://gitea.com/gitea/act_runner). +This is a custom fork of [nektos/act](https://github.com/nektos/act/), for the [Forgejo runner](https://code.forgejo.org/forgejo/runner). It cannot be used as command line tool anymore, but only as a library.