Skip to content

[ci] align labeler with other repositories #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 77 additions & 36 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Issue Labeler"
on:
issues:
types: [opened]
types: [opened, edited, reopened]
pull_request_target:
types: [opened]
types: [opened, synchronize, reopened]

permissions:
contents: read
Expand All @@ -14,12 +14,7 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Add agent-java label
uses: AlexanderWert/issue-labeler@32be4a3c3d8f009c2741af471994337c34b4cb6f # v2.3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler-config.yml
enable-versioned-regex: 0

- name: Get token
id: get_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
Expand All @@ -30,36 +25,82 @@ jobs:
{
"members": "read",
"organization_projects": "write",
"issues": "read"
"issues": "read",
"pull_requests": "write"
}
- name: Check team membership for user
uses: elastic/[email protected]
id: checkUserMember

- name: Add agent-java label
run: gh issue edit "${NUMBER}" --add-label "agent-java" --repo "${{ github.repository }}"
env:
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- id: is_elastic_member
uses: elastic/oblt-actions/github/is-member-of@v1
with:
username: ${{ github.actor }}
team: 'apm'
usernamesToExclude: |
apmmachine
dependabot
obltmachine
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
- name: Show team membership
run: |
echo "::debug::isTeamMember: ${{ steps.checkUserMember.outputs.isTeamMember }}"
echo "::debug::isExcluded: ${{ steps.checkUserMember.outputs.isExcluded }}"
- name: Add community and triage lables
if: steps.checkUserMember.outputs.isTeamMember != 'true' && steps.checkUserMember.outputs.isExcluded != 'true'
uses: AlexanderWert/issue-labeler@32be4a3c3d8f009c2741af471994337c34b4cb6f # v2.3
github-org: "elastic"
github-user: ${{ github.actor }}
github-token: ${{ steps.get_token.outputs.token }}

- id: user_type
uses: elastic/oblt-actions/github/user-type@v1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/community-label.yml
enable-versioned-regex: 0
github-user: ${{ github.actor }}
github-token: ${{ steps.get_token.outputs.token }}

- name: debug
run: |
echo "::notice:: is_elastic_member=${{ steps.is_elastic_member.outputs.result }}"
echo "::notice:: user_type=${{ steps.user_type.outputs.result }}"
echo "::notice:: github.actor=${{ github.actor }}"
echo "::notice:: github.event_name=${{ github.event_name }}"

- name: Add community and triage labels
if: steps.is_elastic_member.outputs.result == 'false' && steps.user_type.outputs.result == 'user'
run: gh issue edit "${NUMBER}" --add-label "community,triage" --repo "${{ github.repository }}"
env:
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Assign new internal pull requests to project
uses: elastic/[email protected]
if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event.pull_request
id: add-to-project
if: steps.is_elastic_member.outputs.result == 'true' && github.event_name == 'pull_request_target'
uses: elastic/oblt-actions/github/project-add@v1
with:
project: 'https://github.com/orgs/elastic/projects/454'
project_id: '5882982'
column_name: 'In Progress'
env:
MY_GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
github-token: ${{ steps.get_token.outputs.token }}
project-id: 1829
item-url: ${{ github.event.pull_request.html_url }}

- name: set status in project
id: set-project-status-field
if: steps.is_elastic_member.outputs.result == 'true' && github.event_name == 'pull_request_target'
uses: elastic/oblt-actions/github/project-field-set@v1
with:
github-token: ${{ steps.get_token.outputs.token }}
project-id: 1829
item-id: ${{ steps.add-to-project.outputs.item-id }}
field-name: 'Status'
field-value: 'In Progress'

- name: set agent in project
id: set-project-agent-field
if: steps.is_elastic_member.outputs.result == 'true' && github.event_name == 'pull_request_target'
uses: elastic/oblt-actions/github/project-field-set@v1
with:
github-token: ${{ steps.get_token.outputs.token }}
project-id: 1829
item-id: ${{ steps.add-to-project.outputs.item-id }}
field-name: 'Agent'
field-value: 'java'

- name: set iteration in project
id: set-project-iteration-field
if: steps.is_elastic_member.outputs.result == 'true' && github.event_name == 'pull_request_target'
uses: elastic/oblt-actions/github/project-field-set@v1
with:
github-token: ${{ steps.get_token.outputs.token }}
project-id: 1829
item-id: ${{ steps.add-to-project.outputs.item-id }}
field-name: 'Iteration'
field-value: '@current'
field-type: 'iteration'
Loading