-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[CI] Create reusable pre-commit workflows #12836
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
base: main
Are you sure you want to change the base?
Changes from all commits
f57cf4a
7ec9396
3b0e644
1dc12f5
110f207
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: pre-commit | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
|
|
||
| jobs: | ||
| run: | ||
| name: Run manual hooks | ||
| uses: ./.github/workflows/pre-commit-reusable.yml | ||
| with: | ||
| job_id: 'manual' | ||
| extra_args: '--hook-stage manual' | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||
| # Licensed to the Apache Software Foundation (ASF) under one | ||||||
| # or more contributor license agreements. See the NOTICE file | ||||||
| # distributed with this work for additional information | ||||||
| # regarding copyright ownership. The ASF licenses this file | ||||||
| # to you under the Apache License, Version 2.0 (the | ||||||
| # "License"); you may not use this file except in compliance | ||||||
| # with the License. You may obtain a copy of the License at | ||||||
| # | ||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| # | ||||||
| # Unless required by applicable law or agreed to in writing, | ||||||
| # software distributed under the License is distributed on an | ||||||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| # KIND, either express or implied. See the License for the | ||||||
| # specific language governing permissions and limitations | ||||||
| # under the License. | ||||||
|
|
||||||
| name: _pre-commit-base | ||||||
|
|
||||||
| on: | ||||||
| workflow_call: | ||||||
| inputs: | ||||||
| extra_args: | ||||||
| required: false | ||||||
| type: string | ||||||
| default: '' | ||||||
| job_id: | ||||||
| required: true | ||||||
| type: string | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| run-hooks: | ||||||
| runs-on: ubuntu-latest | ||||||
|
||||||
| runs-on: ubuntu-latest | |
| runs-on: ubuntu-22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both
pre-commit.ymland this new workflow setname: pre-commitand useconcurrency.group: ${{ github.workflow }}-.... Sincegithub.workflowis the workflow name, these two workflows will share the same concurrency group and end up cancelling each other (becausecancel-in-progress: true), which defeats the goal of having separate checks. Make the workflow names and/or concurrency group strings distinct (e.g., hardcode different group prefixes per workflow file).