name: On Open
on:
  issues:
    types: [opened]

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Actions
        uses: actions/checkout@v2
        with:
          repository: "microsoft/vscode-github-triage-actions"
          ref: v41
          path: ./actions
      - name: Install Actions
        run: npm install --production --prefix ./actions

      - name: Run CopyCat (JacksonKearl/testissues)
        uses: ./actions/copycat
        with:
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          token: ${{secrets.VSCODE_ISSUE_TRIAGE_BOT_PAT}}
          owner: JacksonKearl
          repo: testissues
      - name: Run CopyCat (chrmarti/testissues)
        uses: ./actions/copycat
        with:
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          token: ${{secrets.VSCODE_ISSUE_TRIAGE_BOT_PAT}}
          owner: chrmarti
          repo: testissues

      - name: Run New Release
        uses: ./actions/new-release
        with:
          label: new release
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          labelColor: "006b75"
          labelDescription: Issues found in a recent release of VS Code
          days: 5

      - name: Run Clipboard Labeler
        uses: ./actions/regex-labeler
        with:
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          label: "invalid"
          mustNotMatch: "^We have written the needed data into your clipboard because it was too large to send\\. Please paste\\.$"
          comment: "It looks like you're using the VS Code Issue Reporter but did not paste the text generated into the created issue. We've closed this issue, please open a new one containing the text we placed in your clipboard.\n\nHappy Coding!"

      - name: Run Clipboard Labeler (Chinese)
        uses: ./actions/regex-labeler
        with:
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          label: "invalid"
          mustNotMatch: "^所需的数据太大,无法直接发送。我们已经将其写入剪贴板,请粘贴。$"
          comment: "看起来您正在使用 VS Code 问题报告程序,但是没有将生成的文本粘贴到创建的问题中。我们将关闭这个问题,请使用剪贴板中的内容创建一个新的问题。\n\n祝您使用愉快!"

      # source of truth in ./english-please.yml
      - name: Run English Please
        uses: ./actions/english-please
        with:
          token: ${{secrets.VSCODE_ISSUE_TRIAGE_BOT_PAT}}
          appInsightsKey: ${{secrets.TRIAGE_ACTIONS_APP_INSIGHTS}}
          cognitiveServicesAPIKey: ${{secrets.AZURE_TEXT_TRANSLATOR_KEY}}
          nonEnglishLabel: "*english-please"
          needsMoreInfoLabel: "needs more info"
          translatorRequestedLabelPrefix: "translation-required-"
          translatorRequestedLabelColor: "c29cff"