about summary refs log tree commit diff
path: root/src/tools/clippy/.github/workflows/feature_freeze.yml
blob: 7ad58af77d4ad51111e2a34d86a001f005c8fda7 (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
name: Feature freeze check

on:
  pull_request_target:
    types:
      - opened
    branches:
      - master
    paths:
      - 'clippy_lints/src/declared_lints.rs'

jobs:
  auto-comment:
    runs-on: ubuntu-latest

    permissions:
      pull-requests: write

    # Do not in any case add code that runs anything coming from the  the content
    # of the pull request, as malicious code would be able to access the private
    # GitHub token.
    steps:
    - name: Check PR Changes
      id: pr-changes
      run: echo "::set-output name=changes::${{ toJson(github.event.pull_request.changed_files) }}"

    - name: Create Comment
      if: steps.pr-changes.outputs.changes != '[]'
      run: |
        # Use GitHub API to create a comment on the PR
        PR_NUMBER=${{ github.event.pull_request.number }}
        COMMENT="**Seems that you are trying to add a new lint!**\nWe are currently in a [feature freeze](https://doc.rust-lang.org/nightly/clippy/development/feature_freeze.html), so we are delaying all lint-adding PRs to September 18 and focusing on bugfixes.\nThanks a lot for your contribution, and sorry for the inconvenience.\nWith ❤ from the Clippy team\n\n@rustbot note Feature-freeze\n@rustbot blocked\n@rustbot label +A-lint\n"
        GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
        COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
        curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"