diff --git a/.github/workflows/automatic-pr-labeler.yaml b/.github/workflows/automatic-pr-labeler.yaml new file mode 100644 index 0000000..5fc860b --- /dev/null +++ b/.github/workflows/automatic-pr-labeler.yaml @@ -0,0 +1,43 @@ +--- + +# The workflow template for automatic PR labeler. +# It requires to have a configuration file with labels and conditions to apply them. +# The configuration file should be placed in the .github folder and named auto-labeler-config.yaml. +# Example file can be found there: +# https://github.com/Netcracker/.github/blob/main/config/examples/auto-labeler-config.yaml + +name: Automatic PR Labeler + +on: + pull_request: + branches: [main] + types: + [opened, reopened, synchronize] + +permissions: + pull-requests: write + contents: read + issues: write + +jobs: + assign-labels: + if: github.event.pull_request.merged == false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: "Execute assign labels" + id: action-assign-labels + uses: mauroalderete/action-assign-labels@v1 + with: + pull-request-number: ${{ github.event.pull_request.number }} + github-token: ${{ github.token }} + conventional-commits: "./.github/auto-labeler-config.yaml" + maintain-labels-not-matched: true + apply-changes: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }} + - name: "Drop warning if PR from fork" + if: ${{ github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }} + run: | + echo "⚠️ Pull request from fork! ⚠️" >> $GITHUB_STEP_SUMMARY + echo "Labels will not be applied to PR. Assign them manually please." >> $GITHUB_STEP_SUMMARY + echo "Labels to assign: ${{ steps.action-assign-labels.outputs.labels-next }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/pr-collect-commit-messages.yaml b/.github/workflows/pr-collect-commit-messages.yaml new file mode 100644 index 0000000..360483e --- /dev/null +++ b/.github/workflows/pr-collect-commit-messages.yaml @@ -0,0 +1,24 @@ +--- + +name: "Add commit messages to PR body" + +on: + pull_request: + types: [opened, synchronize] + +permissions: + pull-requests: write + +jobs: + update-pr-body: + runs-on: ubuntu-latest + steps: + - name: "Update PR body" + if: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }} + uses: netcracker/qubership-workflow-hub/actions/pr-add-messages@main + - name: "Warning" + if: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }} + run: | + echo "⚠️ Pull request from fork! ⚠️" >> $GITHUB_STEP_SUMMARY + echo "Can not change PR body." >> $GITHUB_STEP_SUMMARY + diff --git a/.github/workflows/profanity-filter.yaml b/.github/workflows/profanity-filter.yaml new file mode 100644 index 0000000..b8ab778 --- /dev/null +++ b/.github/workflows/profanity-filter.yaml @@ -0,0 +1,27 @@ +--- +name: Profanity filter + +on: + issue_comment: + types: [created, edited] + issues: + types: [opened, edited, reopened] + pull_request: + types: [opened, edited, reopened] + +permissions: + issues: write + pull-requests: write + +jobs: + call-apply-filter: + if: ${{ github.event_name == 'issue_comment' || github.event_name == 'issues' || (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id) }} + uses: Netcracker/qubership-workflow-hub/.github/workflows/profanityFilter.yaml@main + warning: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }} + steps: + - name: "Warning" + run: | + echo "⚠️ Pull request from fork! ⚠️" >> $GITHUB_STEP_SUMMARY + echo "The action cannot be run over PRs from fork." >> $GITHUB_STEP_SUMMARY