Skip to content

Commit 6dace8b

Browse files
committed
[ci:fix] Use updated reusable bot-autoassign workflows
Refines the caller workflows to use the updated `reusable-bot-autoassign.yml` from openwisp-utils. Reduces boilerplate, removes custom installations, and fixes bugs like the bot running on merged PRs.
1 parent 7fd9020 commit 6dace8b

File tree

4 files changed

+33
-178
lines changed

4 files changed

+33
-178
lines changed
Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,19 @@
11
name: Issue Assignment Bot
2-
32
on:
43
issue_comment:
54
types: [created]
6-
75
permissions:
86
contents: read
97
issues: write
10-
118
concurrency:
129
group: bot-autoassign-issue-${{ github.repository }}-${{ github.event.issue.number }}
1310
cancel-in-progress: true
14-
1511
jobs:
1612
respond-to-assign-request:
17-
runs-on: ubuntu-latest
1813
if: github.event.issue.pull_request == null
19-
steps:
20-
- name: Generate GitHub App token
21-
id: generate-token
22-
uses: actions/create-github-app-token@v2
23-
with:
24-
app-id: ${{ secrets.OPENWISP_BOT_APP_ID }}
25-
private-key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
26-
27-
- name: Checkout openwisp-utils
28-
uses: actions/checkout@v6
29-
with:
30-
repository: openwisp/openwisp-utils
31-
ref: master
32-
path: openwisp-utils
33-
34-
- name: Set up Python
35-
uses: actions/setup-python@v6
36-
with:
37-
python-version: "3.13"
38-
39-
- name: Install dependencies
40-
run: pip install -e openwisp-utils/.[github_actions]
41-
42-
- name: Run issue assignment bot
43-
env:
44-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
45-
REPOSITORY: ${{ github.repository }}
46-
GITHUB_EVENT_NAME: ${{ github.event_name }}
47-
run: >
48-
python openwisp-utils/.github/actions/bot-autoassign/__main__.py
49-
issue_assignment "$GITHUB_EVENT_PATH"
14+
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master
15+
with:
16+
bot_command: issue_assignment
17+
secrets:
18+
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
19+
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,20 @@
11
name: PR Issue Auto-Assignment
2-
32
on:
43
pull_request_target:
54
types: [opened, reopened, closed]
6-
75
permissions:
86
contents: read
97
issues: write
108
pull-requests: read
11-
129
concurrency:
1310
group: bot-autoassign-pr-link-${{ github.repository }}-${{ github.event.pull_request.number }}
1411
cancel-in-progress: true
15-
1612
jobs:
1713
auto-assign-issue:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: Generate GitHub App token
21-
id: generate-token
22-
uses: actions/create-github-app-token@v2
23-
with:
24-
app-id: ${{ secrets.OPENWISP_BOT_APP_ID }}
25-
private-key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
26-
27-
- name: Checkout openwisp-utils
28-
uses: actions/checkout@v6
29-
with:
30-
repository: openwisp/openwisp-utils
31-
ref: master
32-
path: openwisp-utils
33-
34-
- name: Set up Python
35-
uses: actions/setup-python@v6
36-
with:
37-
python-version: "3.13"
38-
39-
- name: Install dependencies
40-
run: pip install -e openwisp-utils/.[github_actions]
41-
42-
- name: Run issue assignment bot
43-
env:
44-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
45-
REPOSITORY: ${{ github.repository }}
46-
GITHUB_EVENT_NAME: ${{ github.event_name }}
47-
run: >
48-
python openwisp-utils/.github/actions/bot-autoassign/__main__.py
49-
issue_assignment "$GITHUB_EVENT_PATH"
14+
if: github.event.action != 'closed' || github.event.pull_request.merged == false
15+
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master
16+
with:
17+
bot_command: issue_assignment
18+
secrets:
19+
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
20+
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
Lines changed: 14 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,30 @@
11
name: PR Reopen Reassignment
2-
32
on:
43
pull_request_target:
54
types: [reopened]
65
issue_comment:
76
types: [created]
8-
97
permissions:
108
contents: read
119
issues: write
12-
pull-requests: read
13-
10+
pull-requests: write
1411
concurrency:
1512
group: bot-autoassign-pr-reopen-${{ github.repository }}-${{ github.event.pull_request.number || github.event.issue.number }}
1613
cancel-in-progress: true
17-
1814
jobs:
1915
reassign-on-reopen:
20-
runs-on: ubuntu-latest
2116
if: github.event_name == 'pull_request_target' && github.event.action == 'reopened'
22-
steps:
23-
- name: Generate GitHub App token
24-
id: generate-token
25-
uses: actions/create-github-app-token@v2
26-
with:
27-
app-id: ${{ secrets.OPENWISP_BOT_APP_ID }}
28-
private-key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
29-
30-
- name: Checkout openwisp-utils
31-
uses: actions/checkout@v6
32-
with:
33-
repository: openwisp/openwisp-utils
34-
ref: master
35-
path: openwisp-utils
36-
37-
- name: Set up Python
38-
uses: actions/setup-python@v6
39-
with:
40-
python-version: "3.13"
41-
42-
- name: Install dependencies
43-
run: pip install -e openwisp-utils/.[github_actions]
44-
45-
- name: Reassign issues on PR reopen
46-
env:
47-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
48-
REPOSITORY: ${{ github.repository }}
49-
GITHUB_EVENT_NAME: ${{ github.event_name }}
50-
run: >
51-
python openwisp-utils/.github/actions/bot-autoassign/__main__.py
52-
pr_reopen "$GITHUB_EVENT_PATH"
53-
17+
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master
18+
with:
19+
bot_command: pr_reopen
20+
secrets:
21+
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
22+
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
5423
handle-pr-activity:
55-
runs-on: ubuntu-latest
56-
if: github.event_name == 'issue_comment' && github.event.issue.pull_request
57-
steps:
58-
- name: Generate GitHub App token
59-
id: generate-token
60-
uses: actions/create-github-app-token@v2
61-
with:
62-
app-id: ${{ secrets.OPENWISP_BOT_APP_ID }}
63-
private-key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
64-
65-
- name: Checkout openwisp-utils
66-
uses: actions/checkout@v6
67-
with:
68-
repository: openwisp/openwisp-utils
69-
ref: master
70-
path: openwisp-utils
71-
72-
- name: Set up Python
73-
uses: actions/setup-python@v6
74-
with:
75-
python-version: "3.13"
76-
77-
- name: Install dependencies
78-
run: pip install -e openwisp-utils/.[github_actions]
79-
80-
- name: Handle PR activity
81-
env:
82-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
83-
REPOSITORY: ${{ github.repository }}
84-
GITHUB_EVENT_NAME: ${{ github.event_name }}
85-
run: >
86-
python openwisp-utils/.github/actions/bot-autoassign/__main__.py
87-
pr_reopen "$GITHUB_EVENT_PATH"
24+
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.issue.user.login == github.event.comment.user.login
25+
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master
26+
with:
27+
bot_command: pr_reopen
28+
secrets:
29+
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
30+
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,20 @@
11
name: Stale PR Management
2-
32
on:
43
schedule:
54
- cron: "0 0 * * *"
65
workflow_dispatch:
7-
86
permissions:
97
contents: read
108
issues: write
119
pull-requests: write
12-
1310
concurrency:
1411
group: bot-autoassign-stale-pr-${{ github.repository }}
1512
cancel-in-progress: false
16-
1713
jobs:
1814
manage-stale-prs-python:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Generate GitHub App token
22-
id: generate-token
23-
uses: actions/create-github-app-token@v2
24-
with:
25-
app-id: ${{ secrets.OPENWISP_BOT_APP_ID }}
26-
private-key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}
27-
28-
- name: Checkout openwisp-utils
29-
uses: actions/checkout@v6
30-
with:
31-
repository: openwisp/openwisp-utils
32-
ref: master
33-
path: openwisp-utils
34-
35-
- name: Set up Python
36-
uses: actions/setup-python@v6
37-
with:
38-
python-version: "3.13"
39-
40-
- name: Install dependencies
41-
run: pip install -e openwisp-utils/.[github_actions]
42-
43-
- name: Run stale PR bot
44-
env:
45-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
46-
REPOSITORY: ${{ github.repository }}
47-
run: >
48-
python openwisp-utils/.github/actions/bot-autoassign/__main__.py
49-
stale_pr
15+
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master
16+
with:
17+
bot_command: stale_pr
18+
secrets:
19+
OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }}
20+
OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }}

0 commit comments

Comments
 (0)