Skip to content

Commit 06b2512

Browse files
authored
fix pre-commit workflow remove excess checkout (#3186)
1 parent baf7620 commit 06b2512

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: "[email protected]"
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-java
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-java
44-
ref: ${{ inputs.target-branch || github.ref }}
4543
- uses: actions/setup-python@v4
4644
with:
4745
python-version: '3.11'
@@ -76,7 +74,7 @@ jobs:
7674
FROM_REF: ${{ steps.commit_range.outputs.from_ref }}
7775
TO_REF: ${{ steps.commit_range.outputs.to_ref }}
7876
- name: Commit changes
79-
if: failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
77+
if: failure() && inputs.enable-commit-changes
8078
run: |-
8179
git add -A
8280
git config user.name "${GIT_AUTHOR_NAME}"
@@ -86,8 +84,6 @@ jobs:
8684
exit 1
8785
env:
8886
HEAD_REF: ${{ github.event.pull_request.head.ref }}
89-
GIT_AUTHOR_EMAIL: "[email protected]"
90-
GIT_AUTHOR_NAME: "ci.datadog-api-spec"
9187
- id: pre_commit_schedule
9288
name: Run pre-commit in schedule
9389
if: github.event_name == 'schedule'

0 commit comments

Comments
 (0)