summaryrefslogtreecommitdiff
path: root/.github/workflows/check-sample-issue-template.yml
blob: 7e17beddc3b6839c39bcc6cc64b40e101319a120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Check Sample Issue Template

on:
  pull_request:
    paths:
      - '.github/CODEOWNERS'
      - '.github/ISSUE_TEMPLATE/sample_issue.yml'
      - '.github/ISSUE_TEMPLATE/sample_issue_generator.py'


jobs:
  generate-template:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.x'

      - name: Install dependencies
        run: pip install pyyaml

      - name: Run the generator script
        run: python .github/ISSUE_TEMPLATE/sample_issue_generator.py

      - name: Check for discrepancies
        run: |
          if git diff --quiet .github/ISSUE_TEMPLATE/sample_issue.yml; then
            echo "✅ No discrepancies found. The sample issue template is up to date."
          else
            echo "❌ Discrepancy detected!"
            echo "The CODEOWNERS file was modified, but the sample issue template is not up to date."
            echo ""
            echo "Please regenerate the sample issue template by running:"
            echo "  python .github/ISSUE_TEMPLATE/sample_issue_generator.py"
            echo ""
            echo "Or manually update it."
            echo ""
            echo "Then commit both files together:"
            echo "  git add .github/CODEOWNERS .github/ISSUE_TEMPLATE/sample_issue.yml"
            echo "  git commit -m 'Update CODEOWNERS and regenerate sample issue template'"
            echo ""
            echo "Differences found:"
            git diff .github/ISSUE_TEMPLATE/sample_issue.yml
            exit 1
          fi