diff --git a/.forgejo/workflows/backport.yml b/.forgejo/workflows/backport.yml deleted file mode 100644 index 614a2099af..0000000000 --- a/.forgejo/workflows/backport.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2024 The Forgejo Authors -# SPDX-License-Identifier: MIT -# -name: issue-labels - -on: - pull_request_target: - types: - - closed - - labeled - -jobs: - backporting: - if: > - vars.ROLE == 'forgejo-coding' && - - secrets.BACKPORT_TOKEN != '' && - - github.event_name == 'pull_request_target' && - ( - github.event.pull_request.merged && - contains(toJSON(github.event.pull_request.labels), 'backport/v') - ) - runs-on: docker - container: - image: 'code.forgejo.org/oci/node:20-bookworm' - steps: - - name: Debug info - run: | - cat <<'EOF' - ${{ toJSON(github) }} - EOF - - uses: https://code.forgejo.org/actions/git-backporting@v4.8.4 - with: - target-branch-pattern: "^backport/(?(v.*))$" - strategy: ort - strategy-option: find-renames - cherry-pick-options: -x - auth: ${{ secrets.BACKPORT_TOKEN }} - pull-request: ${{ github.event.pull_request.url }} - auto-no-squash: true - enable-err-notification: true - git-user: forgejo-backport-action - git-email: forgejo-backport-action@noreply.codeberg.org diff --git a/.forgejo/workflows/cascade-setup-end-to-end.yml b/.forgejo/workflows/cascade-setup-end-to-end.yml deleted file mode 100644 index 1c12031b56..0000000000 --- a/.forgejo/workflows/cascade-setup-end-to-end.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2024 The Forgejo Authors -# SPDX-License-Identifier: MIT -# -name: issue-labels - -on: - pull_request_target: - types: - - labeled - -jobs: - end-to-end: - if: > - vars.ROLE == 'forgejo-coding' && - - secrets.END_TO_END_CASCADING_PR_DESTINATION != '' && - secrets.END_TO_END_CASCADING_PR_ORIGIN != '' && - - ( - github.event_name == 'push' || - ( - github.event_name == 'pull_request_target' && - github.event.action == 'label_updated' && - github.event.label.name == 'run-end-to-end-tests' - ) - ) - runs-on: docker - container: - image: code.forgejo.org/oci/node:20-bookworm - steps: - - name: Debug info - run: | - cat <<'EOF' - ${{ toJSON(github) }} - EOF - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - show-progress: 'false' - - uses: actions/cascading-pr@v2 - with: - origin-url: ${{ env.GITHUB_SERVER_URL }} - origin-repo: ${{ github.repository }} - origin-token: ${{ secrets.END_TO_END_CASCADING_PR_ORIGIN }} - origin-pr: ${{ github.event.pull_request.number }} - origin-ref: ${{ github.event_name == 'push' && github.event.ref || '' }} - destination-url: https://code.forgejo.org - destination-fork-repo: cascading-pr/end-to-end - destination-repo: forgejo/end-to-end - destination-branch: main - destination-token: ${{ secrets.END_TO_END_CASCADING_PR_DESTINATION }} - close-merge: true - update: .forgejo/cascading-pr-end-to-end diff --git a/.forgejo/workflows/issue-labels.yml b/.forgejo/workflows/issue-labels.yml new file mode 100644 index 0000000000..886d0640a0 --- /dev/null +++ b/.forgejo/workflows/issue-labels.yml @@ -0,0 +1,205 @@ +# Copyright 2024 The Forgejo Authors +# SPDX-License-Identifier: MIT +# +# To modify the pull_request_target jobs: +# +# - push it to the wip-ci-issue-labels branch on the forgejo repository +# otherwise it will not have access to the required secrets. +# +# - once it works, open a pull request for the sake of keeping track +# of the change even if the PR won't run it because it will use +# whatever is in the default branch instead +# +# - after it is merged, double check it works by changing the labels +# to trigger the job. +# +name: issue-labels + +on: + push: + branches: + - 'wip-ci-issue-labels' + + pull_request_target: + types: + - closed + - edited + - labeled + - synchronize + + pull_request: + types: + - edited + - labeled + - opened + - synchronize + +jobs: + info: + if: vars.ROLE == 'forgejo-coding' + runs-on: docker + container: + image: code.forgejo.org/oci/node:20-bookworm + steps: + - name: Debug info + run: | + cat <<'EOF' + ${{ toJSON(github) }} + EOF + + end-to-end: + if: > + vars.ROLE == 'forgejo-coding' && + + secrets.END_TO_END_CASCADING_PR_DESTINATION != '' && + secrets.END_TO_END_CASCADING_PR_ORIGIN != '' && + + ( + github.event_name == 'push' || + ( + github.event_name == 'pull_request_target' && + github.event.action == 'label_updated' && + github.event.label.name == 'run-end-to-end-tests' + ) + ) + runs-on: docker + container: + image: code.forgejo.org/oci/node:20-bookworm + steps: + - name: Debug info + run: | + cat <<'EOF' + ${{ toJSON(github) }} + EOF + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + show-progress: 'false' + - uses: actions/cascading-pr@v2 + with: + origin-url: ${{ env.GITHUB_SERVER_URL }} + origin-repo: ${{ github.repository }} + origin-token: ${{ secrets.END_TO_END_CASCADING_PR_ORIGIN }} + origin-pr: ${{ github.event.pull_request.number }} + origin-ref: ${{ github.event_name == 'push' && github.event.ref || '' }} + destination-url: https://code.forgejo.org + destination-fork-repo: cascading-pr/end-to-end + destination-repo: forgejo/end-to-end + destination-branch: main + destination-token: ${{ secrets.END_TO_END_CASCADING_PR_DESTINATION }} + close-merge: true + update: .forgejo/cascading-pr-end-to-end + + backporting: + if: > + vars.ROLE == 'forgejo-coding' && + + secrets.BACKPORT_TOKEN != '' && + + github.event_name == 'pull_request_target' && + ( + github.event.pull_request.merged && + contains(toJSON(github.event.pull_request.labels), 'backport/v') + ) + runs-on: docker + container: + image: 'code.forgejo.org/oci/node:20-bookworm' + steps: + - name: Debug info + run: | + cat <<'EOF' + ${{ toJSON(github) }} + EOF + - uses: https://code.forgejo.org/actions/git-backporting@v4.8.4 + with: + target-branch-pattern: "^backport/(?(v.*))$" + strategy: ort + strategy-option: find-renames + cherry-pick-options: -x + auth: ${{ secrets.BACKPORT_TOKEN }} + pull-request: ${{ github.event.pull_request.url }} + auto-no-squash: true + enable-err-notification: true + git-user: forgejo-backport-action + git-email: forgejo-backport-action@noreply.codeberg.org + + merge-conditions: + if: > + vars.ROLE == 'forgejo-coding' && + + github.event_name == 'pull_request' && + ( + github.event.action == 'label_updated' || + github.event.action == 'edited' || + github.event.action == 'opened' + ) + runs-on: docker + container: + image: 'code.forgejo.org/oci/node:20-bookworm' + steps: + - name: Debug info + run: | + cat <<'EOF' + ${{ toJSON(github) }} + EOF + - name: Missing test label + if: > + !( + contains(toJSON(github.event.pull_request.labels), 'test/present') + || contains(toJSON(github.event.pull_request.labels), 'test/not-needed') + || contains(toJSON(github.event.pull_request.labels), 'test/manual') + ) + run: | + echo "Test label must be set to either 'present', 'not-needed' or 'manual'." + exit 1 + - name: Missing manual test instructions + if: > + ( + contains(toJSON(github.event.pull_request.labels), 'test/manual') + && !contains(toJSON(github.event.pull_request.body), '# Test') + ) + run: | + echo "Manual test label is set. The PR description needs to contain test steps introduced by a heading like:" + echo "# Testing" + exit 1 + + release-notes: + if: > + vars.ROLE == 'forgejo-coding' && + + secrets.RELEASE_NOTES_ASSISTANT_TOKEN != '' && + + github.event_name == 'pull_request_target' && + contains(github.event.pull_request.labels.*.name, 'worth a release-note') && + ( + github.event.action == 'label_updated' || + github.event.action == 'edited' || + github.event.action == 'synchronized' + ) + + runs-on: docker + container: + image: 'code.forgejo.org/oci/node:20-bookworm' + steps: + - name: Debug info + run: | + cat <<'EOF' + ${{ toJSON(github) }} + EOF + + - uses: https://code.forgejo.org/actions/checkout@v4 + + - uses: https://code.forgejo.org/actions/setup-go@v5 + with: + go-version-file: "go.mod" + cache: false + + - name: apt install jq + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get -q install -y -qq jq + + - name: release-notes-assistant preview + run: | + go run code.forgejo.org/forgejo/release-notes-assistant@v1.1.1 --config .release-notes-assistant.yaml --storage pr --storage-location ${{ github.event.pull_request.number }} --forgejo-url $GITHUB_SERVER_URL --repository $GITHUB_REPOSITORY --token ${{ secrets.RELEASE_NOTES_ASSISTANT_TOKEN }} preview ${{ github.event.pull_request.number }} diff --git a/.forgejo/workflows/merge-requirements.yml b/.forgejo/workflows/merge-requirements.yml deleted file mode 100644 index fe18aa1139..0000000000 --- a/.forgejo/workflows/merge-requirements.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2024 The Forgejo Authors -# SPDX-License-Identifier: MIT - -name: issue-labels - -on: - pull_request: - types: - - labeled - - edited - - opened - -jobs: - merge-conditions: - if: > - vars.ROLE == 'forgejo-coding' && - - github.event_name == 'pull_request' && - ( - github.event.action == 'label_updated' || - github.event.action == 'edited' || - github.event.action == 'opened' - ) - runs-on: docker - container: - image: 'code.forgejo.org/oci/node:20-bookworm' - steps: - - name: Debug info - run: | - cat <<'EOF' - ${{ toJSON(github) }} - EOF - - name: Missing test label - if: > - !( - contains(toJSON(github.event.pull_request.labels), 'test/present') - || contains(toJSON(github.event.pull_request.labels), 'test/not-needed') - || contains(toJSON(github.event.pull_request.labels), 'test/manual') - ) - run: | - echo "Test label must be set to either 'present', 'not-needed' or 'manual'." - exit 1 - - name: Missing manual test instructions - if: > - ( - contains(toJSON(github.event.pull_request.labels), 'test/manual') - && !contains(toJSON(github.event.pull_request.body), '# Test') - ) - run: | - echo "Manual test label is set. The PR description needs to contain test steps introduced by a heading like:" - echo "# Testing" - exit 1 diff --git a/.forgejo/workflows/release-notes-assistant.yml b/.forgejo/workflows/release-notes-assistant.yml deleted file mode 100644 index 71c8d5f8da..0000000000 --- a/.forgejo/workflows/release-notes-assistant.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: issue-labels - -on: - pull_request_target: - types: - - edited - - synchronize - - labeled - -jobs: - release-notes: - if: > - vars.ROLE == 'forgejo-coding' && - - secrets.RELEASE_NOTES_ASSISTANT_TOKEN != '' && - - github.event_name == 'pull_request_target' && - contains(github.event.pull_request.labels.*.name, 'worth a release-note') && - ( - github.event.action == 'label_updated' || - github.event.action == 'edited' || - github.event.action == 'synchronized' - ) - - runs-on: docker - container: - image: 'code.forgejo.org/oci/node:20-bookworm' - steps: - - name: Debug info - run: | - cat <<'EOF' - ${{ toJSON(github) }} - EOF - - - uses: https://code.forgejo.org/actions/checkout@v4 - - - uses: https://code.forgejo.org/actions/setup-go@v5 - with: - go-version-file: "go.mod" - cache: false - - - name: apt install jq - run: | - export DEBIAN_FRONTEND=noninteractive - apt-get update -qq - apt-get -q install -y -qq jq - - - name: release-notes-assistant preview - run: | - go run code.forgejo.org/forgejo/release-notes-assistant@v1.1.1 --config .release-notes-assistant.yaml --storage pr --storage-location ${{ github.event.pull_request.number }} --forgejo-url $GITHUB_SERVER_URL --repository $GITHUB_REPOSITORY --token ${{ secrets.RELEASE_NOTES_ASSISTANT_TOKEN }} preview ${{ github.event.pull_request.number }}