mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
ci: ignore draft PR add add backport labels (#382)
* ci: skip draft PR Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * ci: fix auto assign Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * ci: add backport label Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * fix: remove token Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> --------- Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
85a06feb91
commit
ee28697161
9
.github/workflows/auto-assign-reviewer.yaml
vendored
9
.github/workflows/auto-assign-reviewer.yaml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: "[PR Management] Auto Assign Reviewer"
|
name: "[PR Management] Auto Assign Reviewer & Assignee"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
@ -9,8 +9,9 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
auto-assign:
|
auto-assign:
|
||||||
|
if: github.event.pull_request.draft == false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: rancher/gh-issue-mgr/auto-assign-action@main
|
- uses: rancher/gh-issue-mgr/auto-assign-action@main
|
||||||
with:
|
with:
|
||||||
configuration-path: .github/auto-assign-config.yaml
|
configuration-path: .github/auto-assign-config.yaml
|
||||||
39
.github/workflows/backport-label.yaml
vendored
39
.github/workflows/backport-label.yaml
vendored
@ -1,15 +1,19 @@
|
|||||||
name: "[PR Management] Add Backport Label"
|
name: "[PR Management] Add Labels"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, reopened]
|
types: [opened, reopened]
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
|
- 'release-harvester-v*'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add-backport-label:
|
add-require-backport-label:
|
||||||
|
if: github.event.pull_request.draft == false &&
|
||||||
|
github.event.pull_request.base.ref == 'main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@ -52,7 +56,7 @@ jobs:
|
|||||||
pr_labels_csv=$(echo "$pr_labels" | tr '\n' ',' | sed 's/,$//')
|
pr_labels_csv=$(echo "$pr_labels" | tr '\n' ',' | sed 's/,$//')
|
||||||
echo "pr_labels=$pr_labels_csv" >> "$GITHUB_OUTPUT"
|
echo "pr_labels=$pr_labels_csv" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Add backport label if needed
|
- name: Add label if needed
|
||||||
if: steps.fetch_info.outputs.should_label == 'true' && !contains(steps.fetch_info.outputs.pr_labels, steps.fetch_info.outputs.backport_label)
|
if: steps.fetch_info.outputs.should_label == 'true' && !contains(steps.fetch_info.outputs.pr_labels, steps.fetch_info.outputs.backport_label)
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -61,3 +65,30 @@ jobs:
|
|||||||
gh pr edit ${{ github.event.pull_request.number }} \
|
gh pr edit ${{ github.event.pull_request.number }} \
|
||||||
--repo ${{ github.repository }} \
|
--repo ${{ github.repository }} \
|
||||||
--add-label "${{ steps.fetch_info.outputs.backport_label }}"
|
--add-label "${{ steps.fetch_info.outputs.backport_label }}"
|
||||||
|
|
||||||
|
add-backport-label:
|
||||||
|
if: github.event.pull_request.draft == false &&
|
||||||
|
startsWith(github.event.pull_request.base.ref, 'release-harvester-v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check conditions for backport label
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
IS_MERGIFY=$(echo '${{ github.event.pull_request.user.login }}' | grep -iq 'mergify' && echo true || echo false)
|
||||||
|
TARGET_BRANCH=${{ github.event.pull_request.base.ref }}
|
||||||
|
|
||||||
|
echo "IS_MERGIFY=$IS_MERGIFY" >> $GITHUB_OUTPUT
|
||||||
|
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Add label if needed
|
||||||
|
if: steps.check.outputs.IS_MERGIFY == 'true' && startsWith(steps.check.outputs.TARGET_BRANCH, 'release-harvester-v')
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
TARGET_BRANCH="${{ steps.check.outputs.TARGET_BRANCH }}"
|
||||||
|
version="${TARGET_BRANCH#release-harvester-v}"
|
||||||
|
label="backport/v${version}"
|
||||||
|
echo "Adding label $label"
|
||||||
|
gh pr edit ${{ github.event.pull_request.number }} \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
|
--add-label "$label"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user