From 98439b916badc1247d444be85bc19e39c135397d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 6 Aug 2022 21:12:07 +0200 Subject: [PATCH] chore: add auto-analyze.yml action (#1009) Co-authored-by: th33xitus --- .github/workflows/auto-analyze.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/auto-analyze.yml diff --git a/.github/workflows/auto-analyze.yml b/.github/workflows/auto-analyze.yml new file mode 100644 index 00000000..700d002f --- /dev/null +++ b/.github/workflows/auto-analyze.yml @@ -0,0 +1,41 @@ +name: 'Auto add analyze label if package.json was edited' + +on: + pull_request: + branches: + - develop + +permissions: + pull-requests: write + +jobs: + add-analyze-label: + name: 'Add analyze label' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v24.1 + + - name: Get package.json is changed file + id: changed-file-package-json + uses: tj-actions/changed-files@v24.1 + with: + files: | + package.json + + - name: Add Label + if: steps.changed-file-package-json.outputs.any_changed == 'true' + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['analyze'] + })