|
| 1 | +# Copyright The OpenTelemetry Authors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# adds a label to a pull request if certain files are changed |
| 4 | +name: Label Pull Requests |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize, reopened] |
| 9 | + |
| 10 | +jobs: |
| 11 | + label: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Check for changed files |
| 18 | + id: file_changes |
| 19 | + uses: dorny/paths-filter@v2 |
| 20 | + with: |
| 21 | + list-files: shell |
| 22 | + filters: | |
| 23 | + docsUpdateRequired: |
| 24 | + - 'src/flagd/**' |
| 25 | + helmUpdateRequired: |
| 26 | + - '.env' |
| 27 | + - 'docker-compose*.yml' |
| 28 | + - 'src/flagd/**' |
| 29 | + - 'src/grafana/**' |
| 30 | + - 'src/otelcollector/**' |
| 31 | + - 'src/prometheus/**' |
| 32 | +
|
| 33 | + - name: "Add Label: docs-update-required" |
| 34 | + if: steps.file_changes.outputs.docsUpdateRequired == 'true' |
| 35 | + uses: actions/github-script@v3 |
| 36 | + with: |
| 37 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 38 | + script: | |
| 39 | + const issue_number = context.issue.number; |
| 40 | + github.issues.addLabels({ |
| 41 | + issue_number: issue_number, |
| 42 | + owner: context.repo.owner, |
| 43 | + repo: context.repo.repo, |
| 44 | + labels: ['docs-update-required'] |
| 45 | + }) |
| 46 | +
|
| 47 | + - name: "Add Label: helm-update-required" |
| 48 | + if: steps.file_changes.outputs.helmUpdateRequired == 'true' |
| 49 | + uses: actions/github-script@v3 |
| 50 | + with: |
| 51 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 52 | + script: | |
| 53 | + const issue_number = context.issue.number; |
| 54 | + github.issues.addLabels({ |
| 55 | + issue_number: issue_number, |
| 56 | + owner: context.repo.owner, |
| 57 | + repo: context.repo.repo, |
| 58 | + labels: ['helm-update-required'] |
| 59 | + }) |
0 commit comments