name: Issue labeled

on:
  issues:
    types: [labeled]

permissions:
  contents: read

jobs:
  issueLabeled:
    permissions:
      issues: write
      pull-requests: write
    runs-on: 'ubuntu-24.04'
    steps:
      - name: Add invalid version comment
        uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
        if: ${{ github.event.label.name == 'Invalid version' }}
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          issue-number: ${{ github.event.issue.number }}
          body: >
            It looks like the version in which you encounter the issue is not the [latest version](https://github.com/breezy-weather/breezy-weather/releases) of Breezy Weather. The latest version contains potential fixes and troubleshooting improvements, so we kindly ask you to update first. If you are getting updates from the F-Droid default repo, you don’t need to uninstall your currently installed version. If you can still reproduce your issue after updating, please re-open a new issue.

      - name: Add needs debug logs comment
        uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
        if: ${{ github.event.label.name == 'Needs debug logs' }}
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          issue-number: ${{ github.event.issue.number }}
          body: >
            Please go to `Settings` > `Debug` > `Share crash logs` and copy the content of the text file in a comment, so we can have more technical details about the issue you encounter.
