···11# Copyright 2024 The Forgejo Authors
22# SPDX-License-Identifier: MIT
33#
44-# To modify this workflow:
55-#
66-# - change pull_request_target: to pull_request:
77-# so that it runs from a pull request instead of the default branch
88-#
99-# - push it to the wip-ci-backport branch on the forgejo repository
1010-# otherwise it will not have access to the secrets required to push
1111-# the PR
1212-#
1313-# - open a pull request targetting wip-ci-backport that includes a change
1414-# that can be backported without conflict in v1.21 and set the
1515-# `backport/v1.21` label.
1616-#
1717-# - once it works, open a pull request for the sake of keeping track
1818-# of the change even if the PR won't run it because it will use
1919-# whatever is in the default branch instead
2020-#
2121-# - after it is merged, double check it works by setting a
2222-# `backport/v1.21` label on a merged pull request that can be backported
2323-# without conflict.
2424-#
44+name: issue-labels
55+256on:
267 pull_request_target:
278 types:
···3112jobs:
3213 backporting:
3314 if: >
3434- ( vars.ROLE == 'forgejo-coding' ) && (
3535- github.event.pull_request.merged
3636- &&
1515+ vars.ROLE == 'forgejo-coding' &&
1616+1717+ secrets.BACKPORT_TOKEN != '' &&
1818+1919+ github.event_name == 'pull_request_target' &&
2020+ (
2121+ github.event.pull_request.merged &&
3722 contains(toJSON(github.event.pull_request.labels), 'backport/v')
3823 )
3924 runs-on: docker
4025 container:
4126 image: 'code.forgejo.org/oci/node:20-bookworm'
4227 steps:
4343- - name: event info
2828+ - name: Debug info
4429 run: |
4530 cat <<'EOF'
4631 ${{ toJSON(github) }}