Skip to content

Commit a9e8ae9

Browse files
authored
fix pre-commit workflow excess checkout (#2892)
1 parent 0c4cccd commit a9e8ae9

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,20 @@ env:
2626
jobs:
2727
pre-commit:
2828
runs-on: ubuntu-latest
29-
if: >
30-
(github.event.pull_request.draft == false &&
31-
!contains(github.event.pull_request.labels.*.name, 'ci/skip') &&
32-
!contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/')) ||
33-
github.event_name == 'schedule'
3429
steps:
3530
- name: Get GitHub App token
3631
id: get_token
37-
if: inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
32+
if: inputs.enable-commit-changes
3833
uses: actions/create-github-app-token@v1
3934
with:
4035
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
4136
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
4237
- uses: actions/checkout@v3
43-
if: github.event.pull_request.head.repo.full_name == github.repository
4438
with:
39+
fetch-depth: 0
4540
repository: DataDog/datadog-api-client-typescript
4641
ref: ${{ inputs.target-branch || github.event.pull_request.head.sha || github.ref }}
47-
fetch-depth: 50
4842
token: ${{ inputs.enable-commit-changes && steps.get_token.outputs.token || github.token }}
49-
- uses: actions/checkout@v3
50-
if: github.event.pull_request.head.repo.full_name != github.repository
51-
with:
52-
repository: DataDog/datadog-api-client-typescript
53-
ref: ${{ inputs.target-branch || github.event.pull_request.head.sha || github.ref }}
54-
fetch-depth: 50
5543
- uses: actions/setup-python@v4
5644
with:
5745
python-version: '3.11'
@@ -78,7 +66,7 @@ jobs:
7866
if: github.event.action != 'closed' && github.event.pull_request.merged != true
7967
run: bash -c "./generate.sh"
8068
- name: Commit changes
81-
if: failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
69+
if: ${{ failure() && inputs.enable-commit-changes }}
8270
run: |-
8371
git add -A
8472
git config user.name "${GIT_AUTHOR_NAME}"

0 commit comments

Comments
 (0)