Skip to content

Commit be44d1c

Browse files
authored
fix pre-commit workflow remove excess checkout (#966)
1 parent 37aa74f commit be44d1c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

.github/workflows/reusable-pre-commit.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,27 @@ on:
1919
PIPELINE_GITHUB_APP_PRIVATE_KEY:
2020
required: false
2121

22+
env:
23+
GIT_AUTHOR_EMAIL: "packages@datadoghq.com"
24+
GIT_AUTHOR_NAME: "ci.datadog-api-spec"
25+
2226
jobs:
2327
pre-commit:
2428
runs-on: ubuntu-latest
2529
steps:
2630
- name: Get GitHub App token
27-
if: inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
2831
id: get_token
32+
if: inputs.enable-commit-changes
2933
uses: actions/create-github-app-token@v1
3034
with:
3135
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
3236
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
3337
- uses: actions/checkout@v3
34-
if: github.event.pull_request.head.repo.full_name == github.repository
3538
with:
3639
fetch-depth: 0
3740
repository: DataDog/datadog-api-client-rust
3841
ref: ${{ inputs.target-branch || github.event.pull_request.head.sha || github.ref }}
3942
token: ${{ inputs.enable-commit-changes && steps.get_token.outputs.token || github.token }}
40-
- uses: actions/checkout@v3
41-
if: github.event.pull_request.head.repo.full_name != github.repository
42-
with:
43-
repository: DataDog/datadog-api-client-rust
44-
ref: ${{ inputs.target-branch || github.ref }}
4543
- name: Install pre-commit
4644
run: python -m pip install pre-commit
4745
- name: set PY
@@ -66,7 +64,7 @@ jobs:
6664
FROM_REF: ${{ steps.commit_range.outputs.from_ref }}
6765
TO_REF: ${{ steps.commit_range.outputs.to_ref }}
6866
- name: Commit changes
69-
if: failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
67+
if: ${{ failure() && inputs.enable-commit-changes }}
7068
run: |-
7169
git add -A
7270
git config user.name "${GIT_AUTHOR_NAME}"
@@ -76,8 +74,6 @@ jobs:
7674
exit 1
7775
env:
7876
HEAD_REF: ${{ github.event.pull_request.head.ref }}
79-
GIT_AUTHOR_EMAIL: "packages@datadoghq.com"
80-
GIT_AUTHOR_NAME: "ci.datadog-api-spec"
8177
- id: pre_commit_schedule
8278
name: Run pre-commit in schedule
8379
if: github.event_name == 'schedule'

0 commit comments

Comments
 (0)