From 7c1f3a7594a9c08ced59662a527d7ded8d1c098b Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 18 Nov 2024 19:40:15 +0100 Subject: [PATCH] chore(ci): cat all issue labels workflows in issue-labels.yml cat cascade-setup-end-to-end.yml backport.yml merge-requirements.yml release-notes-assistant.yml > issue-labels.yml rm cascade-setup-end-to-end.yml backport.yml merge-requirements.yml release-notes-assistant.yml --- .forgejo/workflows/backport.yml | 44 ---- .../workflows/cascade-setup-end-to-end.yml | 53 ----- .forgejo/workflows/issue-labels.yml | 199 ++++++++++++++++++ .forgejo/workflows/merge-requirements.yml | 52 ----- .../workflows/release-notes-assistant.yml | 50 ----- 5 files changed, 199 insertions(+), 199 deletions(-) delete mode 100644 .forgejo/workflows/backport.yml delete mode 100644 .forgejo/workflows/cascade-setup-end-to-end.yml create mode 100644 .forgejo/workflows/issue-labels.yml delete mode 100644 .forgejo/workflows/merge-requirements.yml delete mode 100644 .forgejo/workflows/release-notes-assistant.yml 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..0424304b50 --- /dev/null +++ b/.forgejo/workflows/issue-labels.yml @@ -0,0 +1,199 @@ +# 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 +# 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 +# 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 +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 }} 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 }}