Skip to content

Commit f267ae6

Browse files
authored
simplify labels + add to project (#598)
* simplify labels + add to project * add missing bits + simplify PR URL
1 parent 76c1c2c commit f267ae6

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

.github/workflows/labeler.yml

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
triage:
1515
runs-on: ubuntu-latest
1616
steps:
17+
1718
- name: Get token
1819
id: get_token
1920
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
@@ -26,33 +27,27 @@ jobs:
2627
"organization_projects": "write",
2728
"issues": "read"
2829
}
30+
2931
- name: Add agent-java label
30-
uses: actions/github-script@v7
31-
with:
32-
script: |
33-
github.rest.issues.addLabels({
34-
issue_number: context.issue.number,
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
labels: ["agent-java"]
38-
})
32+
run: gh issue edit "${NUMBER}" --add-label "agent-java" --repo "${{ github.repository }}"
33+
env:
34+
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
3937
- id: is_elastic_member
4038
uses: elastic/oblt-actions/github/is-member-of@v1
4139
with:
4240
github-org: "elastic"
4341
github-user: ${{ github.actor }}
4442
github-token: ${{ steps.get_token.outputs.token }}
43+
4544
- name: Add community and triage labels
4645
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'elastic-renovate-prod[bot]' && github.actor != 'elastic-observability-automation[bot]'
47-
uses: actions/github-script@v7
48-
with:
49-
script: |
50-
github.rest.issues.addLabels({
51-
issue_number: context.issue.number,
52-
owner: context.repo.owner,
53-
repo: context.repo.repo,
54-
labels: ["community", "triage"]
55-
})
46+
run: gh issue edit "${NUMBER}" --add-label "community,triage" --repo "${{ github.repository }}"
47+
env:
48+
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
5651
- name: Add comment for community PR
5752
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'elastic-renovate-prod[bot]' && github.actor != 'elastic-observability-automation[bot]'
5853
uses: wow-actions/auto-comment@v1
@@ -64,12 +59,46 @@ jobs:
6459
It may take some time before we review a PR, so even if you don’t see activity for some time, it **does not** mean that we have forgotten about it.
6560
6661
Every once in a while we go through a process of prioritization, after which we are focussing on the tasks that were planned for the upcoming [milestone](https://github.com/elastic/apm-agent-java/milestones). The prioritization status is typically reflected through the PR labels. It could be pending triage, a candidate for a future milestone, or have a target milestone set to it.
62+
6763
- name: Assign new internal pull requests to project
68-
uses: elastic/[email protected]
69-
if: contains(steps.is_elastic_member.outputs.result, 'true') && github.event.pull_request
70-
env:
71-
MY_GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
64+
id: add-to-project
65+
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event_name == 'pull_request'
66+
uses: elastic/oblt-actions/github/project-add@v1
7267
with:
73-
project: 'https://github.com/orgs/elastic/projects/454'
74-
project_id: '5882982'
75-
column_name: 'In Progress'
68+
github-token: ${{ steps.get_token.outputs.token }}
69+
project-id: 1829
70+
item-url: ${{ github.event.pull_request.url }}
71+
72+
- name: set status in project
73+
id: set-project-status-field
74+
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event_name == 'pull_request'
75+
uses: elastic/oblt-actions/github/project-field-set@v1
76+
with:
77+
github-token: ${{ steps.get_token.outputs.token }}
78+
project-id: 1829
79+
item-id: ${{ steps.add-to-project.outputs.item-id }}
80+
field-name: 'Status'
81+
field-value: 'In Progress'
82+
83+
- name: set agent in project
84+
id: set-project-agent-field
85+
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event_name == 'pull_request'
86+
uses: elastic/oblt-actions/github/project-field-set@v1
87+
with:
88+
github-token: ${{ steps.get_token.outputs.token }}
89+
project-id: 1829
90+
item-id: ${{ steps.add-to-project.outputs.item-id }}
91+
field-name: 'Agent'
92+
field-value: 'java'
93+
94+
- name: set iteration in project
95+
id: set-project-iteration-field
96+
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event_name == 'pull_request'
97+
uses: elastic/oblt-actions/github/project-field-set@v1
98+
with:
99+
github-token: ${{ steps.get_token.outputs.token }}
100+
project-id: 1829
101+
item-id: ${{ steps.add-to-project.outputs.item-id }}
102+
field-name: 'Iteration'
103+
field-value: '@current'
104+
field-type: 'iteration'

0 commit comments

Comments
 (0)