-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
77 lines (76 loc) · 2.54 KB
/
hosting-comment-hoster.yml
File metadata and controls
77 lines (76 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Hosting hoster
on:
issue_comment:
types:
- created
- edited
jobs:
validate:
runs-on: ubuntu-latest
if: ${{ github.event.comment.body == '/hosting host' }}
outputs:
actor_in_hosting_team: ${{ steps.checkUserMember.outputs.isTeamMember }}
steps:
- uses: tspascoal/get-user-teams-membership@57e9f42acd78f4d0f496b3be4368fc5f62696662 # v2
id: checkUserMember
with:
username: ${{ github.actor }}
team: 'hosting'
GITHUB_TOKEN: ${{ secrets.HOSTING_PAT }}
hosting:
runs-on: ubuntu-latest
needs: [validate]
if: needs.validate.outputs.actor_in_hosting_team == 'true'
steps:
- name: Ack
uses: actions/github-script@v8
with:
script: |
const {owner, repo} = context.issue
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "+1",
});
- uses: actions/checkout@v6
with:
ref: 'master'
- uses: actions/setup-java@v5
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '25'
cache: 'maven'
- name: Build with Maven
run: mvn -B package -Dspotbugs.skip
- name: Run hoster
run: |
java -jar target/repository-permissions-updater-1.0-SNAPSHOT-bin/repository-permissions-updater-1.0-SNAPSHOT.jar host ${{ github.event.issue.number }}
env:
GITHUB_OAUTH: ${{ secrets.HOSTING_PAT }}
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.JIRA_PASSWORD }}
hosting-denied:
runs-on: ubuntu-latest
needs: [validate]
if: needs.validate.outputs.actor_in_hosting_team != 'true'
steps:
- name: React `-1` and post denial comment
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.issue;
const comment_id = context.payload.comment.id;
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id,
content: '-1',
});
github.rest.issues.createComment({
owner,
repo,
issue_number: context.issue.number,
body: `@${context.actor} only the hosting team can use this command to host the repository, once it's ready.`,
});