Skip to content

Add feature freeze workflow #14546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/clippy_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
cancel-in-progress: true

jobs:

changelog:
runs-on: ubuntu-latest

Expand All @@ -24,18 +25,56 @@ jobs:
- name: Check Changelog
if: ${{ github.event_name == 'pull_request' }}
run: |
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/rust-lang/rust-clippy/pulls/$PR_NUMBER" | \
body=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/blyxyas/rust-clippy/pulls/$PR_NUMBER" | \
python -c "import sys, json; print(json.load(sys.stdin)['body'])")
output=$(awk '/^changelog:\s*\S/ && !/changelog: \[.*\]: your change/' <<< "$body" | sed "s/changelog:\s*//g")
if [ -z "$output" ]; then
echo "ERROR: pull request message must contain 'changelog: ...' with your changelog. Please add it."
exit 1
else
echo "changelog: $output"
if [[ "${output}" == \[\`* ]]; then
echo "LINT_CHANGELOG=\"${output}\"" >> $GITHUB_ENV
else
echo "LINT_CHANGELOG=\"meowmeow\"" >> $GITHUB_ENV
fi
fi
env:
PYTHONIOENCODING: 'utf-8'
PR_NUMBER: '${{ github.event.number }}'
- name: New Lint Label
uses: actions/github-script@v7
with:
script: |
let res = await github.rest.issues.listLabelsOnIssue({
owner: 'blyxyas',
repo: 'rust-clippy',
issue_number: ${{ github.event.number }}
})
let names = res.data.map((element) => element.name);

// We've already visited this PR
if (!names.includes('A-new-lint')) {
// Check if we're with a new lint (there are 0 mentions of this lint on the codebase
if (${{ env.LINT_CHANGELOG }} != "") {
const lint_name = /\[`(.*)`\]/g.exec(${{ env.LINT_CHANGELOG }}).slice(1);
let lint_name_upper = lint_name.toString().toUpperCase();
let res = await octokit.rest.search.code({
q: `${lint_name_upper} repo:rust-lang/rust-clippy`,
per_page: 1,
});

if (res.data.items.length == 0) {
await octokit.rest.issues.createComment({
owner: "blyxyas",
repo: "rust-clippy",
issue_number: ${{ github.event.number }},
body: "Seems that you are trying to add a new lint! We are currently in a feature freeze, I'll add it to a milestone."
});
}
}
}


# We need to have the "conclusion" job also on PR CI, to make it possible
# to add PRs to a merge queue.
Expand Down