From abb8ede0bc57d433e237762ba29288da45554403 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 15 Aug 2023 14:40:54 +0000 Subject: [PATCH] ci: assigner: add module and issue support, enable issue Add a scheduled entry to run_assignee to run the module assignment function periodically, as well as a target to run the issue code when issue labels are changed. Signed-off-by: Fabio Baltieri --- .github/workflows/assigner.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/assigner.yml b/.github/workflows/assigner.yml index 87293159056..847704bff45 100644 --- a/.github/workflows/assigner.yml +++ b/.github/workflows/assigner.yml @@ -10,6 +10,9 @@ on: branches: - main - v*-branch + issues: + types: + - labeled jobs: assignment: @@ -21,7 +24,7 @@ jobs: - name: Install Python dependencies run: | sudo pip3 install -U setuptools wheel pip - pip3 install -U PyGithub>=1.55 + pip3 install -U PyGithub>=1.55 west - name: Check out source code uses: actions/checkout@v3 @@ -30,9 +33,19 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }} run: | - python3 scripts/set_assignees.py \ - -v \ - -o ${{ github.event.repository.owner.login }} \ - -r ${{ github.event.repository.name }} \ - -M MAINTAINERS.yml \ - -P ${{ github.event.pull_request.number }} + FLAGS="-v" + FLAGS+=" -o ${{ github.event.repository.owner.login }}" + FLAGS+=" -r ${{ github.event.repository.name }}" + FLAGS+=" -M MAINTAINERS.yml" + if [ "${{ github.event_name }}" = "pull_request_target" ]; then + FLAGS+=" -P ${{ github.event.pull_request.number }}" + elif [ "${{ github.event_name }}" = "issues" ]; then + FLAGS+=" -I ${{ github.event.issue.number }}" + elif [ "${{ github.event_name }}" = "schedule" ]; then + FLAGS+=" --modules" + else + echo "Unknown event: ${{ github.event_name }}" + exit 1 + endif + + python3 scripts/set_assignees.py $FLAGS