Skip to content

Commit 437fd18

Browse files
remalremal-github-actions
andauthored
Template repository changes: remal-github-actions/template-typescript (#1267)
Co-authored-by: remal-github-actions <77626445+remal-github-actions+sync-with-template@users.noreply.github.com>
1 parent 7c2a1bb commit 437fd18

File tree

4 files changed

+59
-17
lines changed

4 files changed

+59
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/workflows/auto-assign-issue.yml

.github/workflows/auto-assign-issue.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/auto-assign.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Auto-assign issues or PRs
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- transferred
8+
pull_request:
9+
types:
10+
- opened
11+
12+
env:
13+
DEFAULT_ASSIGNEE: ${{secrets.DEFAULT_ASSIGNEE || 'remal'}}
14+
15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
auto-assign:
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 5
27+
steps:
28+
- name: Define assignee
29+
id: assignee
30+
uses: actions/github-script@v7
31+
with:
32+
script: |
33+
const repository = await github.rest.repos.get({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
}).then(it => it.data)
37+
const isOrg = repository.owner.type == 'Organization'
38+
if (!isOrg) {
39+
core.setOutput('assignee', context.repo.owner)
40+
return
41+
}
42+
43+
const defaultAssignee = '${{env.DEFAULT_ASSIGNEE}}'
44+
const members = (await github.paginate(github.rest.orgs.listMembers, {
45+
org: context.repo.owner,
46+
})).filter(it => it.type === 'User').map(it => it.login)
47+
if (members.includes(defaultAssignee)) {
48+
core.setOutput('assignee', defaultAssignee)
49+
return
50+
}
51+
52+
- name: Auto-assign ${{github.event == 'pull_request' && 'PR' || 'issue'}}
53+
if: ${{steps.assignee.outputs.assignee}}
54+
uses: pozil/auto-assign-issue@v1
55+
with:
56+
assignees: ${{steps.assignee.outputs.assignee}}
57+
abortIfPreviousAssignees: true

.github/workflows/check-action-secrets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
check-action-secrets:
2020
name: Check action secrets
2121
runs-on: ubuntu-latest
22-
timeout-minutes: 10
22+
timeout-minutes: 5
2323
concurrency:
2424
group: check-action-secrets
2525
cancel-in-progress: true

0 commit comments

Comments
 (0)