mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-05-14 15:01:44 +00:00
ci: update auto assign workflow
Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
9a8a709e56
commit
f3c442f0ea
1
.github/auto-assign-config.yaml
vendored
1
.github/auto-assign-config.yaml
vendored
@ -1,6 +1,5 @@
|
||||
addAssignees: author
|
||||
addReviewers: true
|
||||
numberOfReviewers: 0
|
||||
reviewers:
|
||||
- a110605
|
||||
- houhoucoop
|
||||
17
.github/workflows/auto-assign-reviewer.yaml
vendored
17
.github/workflows/auto-assign-reviewer.yaml
vendored
@ -1,17 +0,0 @@
|
||||
name: "[PR Management] Auto Assign Reviewer & Assignee"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, ready_for_review]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
auto-assign:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rancher/gh-issue-mgr/auto-assign-action@main
|
||||
with:
|
||||
configuration-path: .github/auto-assign-config.yaml
|
||||
55
.github/workflows/pr-management-auto-assign-action.yaml
vendored
Normal file
55
.github/workflows/pr-management-auto-assign-action.yaml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: "PR Management Auto Assign"
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR Management Auto Assign Collect Data"]
|
||||
types: [completed]
|
||||
|
||||
env:
|
||||
REPO_NAME: harvester/harvester-ui-extension
|
||||
|
||||
jobs:
|
||||
auto-assign:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Download PR data artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: pr-auto-assign-data
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
|
||||
- name: Load PR data
|
||||
run: |
|
||||
cat pr-auto-assign-data.env >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Auto assign based on config
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Read config
|
||||
ADD_ASSIGNEES=$(yq e '.addAssignees' .github/auto-assign-config.yaml)
|
||||
ADD_REVIEWERS=$(yq e '.addReviewers' .github/auto-assign-config.yaml)
|
||||
REVIEWERS=$(yq e '.reviewers[]' .github/auto-assign-config.yaml 2>/dev/null || true)
|
||||
|
||||
# Assign author if addAssignees is 'author'
|
||||
if [[ "$ADD_ASSIGNEES" == "author" ]]; then
|
||||
echo "Assigning PR author: $PR_AUTHOR"
|
||||
gh pr edit "$PR_NUMBER" --repo "${REPO_NAME}" --add-assignee "$PR_AUTHOR"
|
||||
fi
|
||||
|
||||
# Add reviewers if addReviewers is true and reviewers list is non-empty
|
||||
if [[ "$ADD_REVIEWERS" == "true" && -n "$REVIEWERS" ]]; then
|
||||
SELECTED=$(echo "$REVIEWERS" | xargs)
|
||||
echo "Adding reviewers: $SELECTED"
|
||||
for reviewer in $SELECTED; do
|
||||
gh pr edit "$PR_NUMBER" --repo "${REPO_NAME}" --add-reviewer "$reviewer"
|
||||
done
|
||||
fi
|
||||
25
.github/workflows/pr-management-auto-assign.yaml
vendored
Normal file
25
.github/workflows/pr-management-auto-assign.yaml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
name: "PR Management Auto Assign Collect Data"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
collect:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: Save PR data to artifact
|
||||
run: |
|
||||
{
|
||||
echo "PR_NUMBER=${{ github.event.pull_request.number }}"
|
||||
echo "PR_AUTHOR=${{ github.event.pull_request.user.login }}"
|
||||
} > pr-auto-assign-data.env
|
||||
|
||||
- name: Upload PR data artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pr-auto-assign-data
|
||||
path: pr-auto-assign-data.env
|
||||
Loading…
x
Reference in New Issue
Block a user