name: Label APM Ecosystems issues
on:
  issues:
    types:
      - reopened
      - opened
      - edited
permissions:
  contents: read
  issues: write
  id-token: write
jobs:
  label_issues:
    if: contains(github.event.issue.title, 'contrib')
    runs-on: ubuntu-latest
    steps:
      # Retrieve temporary github token
      - name: Get Github token
        uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
        id: octo-sts
        with:
          policy: self.ecosystems-label-issue
          scope: DataDog/dd-trace-go
      # https://github.com/marketplace/actions/actions-ecosystem-add-labels
      - name: add label
        uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
        with:
          labels: apm:ecosystem
        env:
          GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
