diff --git a/.github/workflows/docs-change.yml b/.github/workflows/docs-change.yml new file mode 100644 index 00000000..f0f51d6b --- /dev/null +++ b/.github/workflows/docs-change.yml @@ -0,0 +1,34 @@ +name: Automatisch Docs Change +on: + pull_request: + paths: + - 'packages/docs/**' +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Label PR + uses: actions/github-script@v6 + with: + script: | + const github = require('@actions/github'); + const { context } = github; + const { pull_request } = context.payload; + + const label = 'documentation-change'; + const hasLabel = pull_request.labels.some(({ name }) => name === label); + + if (!hasLabel) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pull_request.number, + labels: [label], + }); + + console.log(`Label "${label}" added to PR #${pull_request.number}`); + } else { + console.log(`Label "${label}" already exists on PR #${pull_request.number}`); + }