Skip to content
Merged
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
16 changes: 6 additions & 10 deletions .github/workflows/reusable-pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,27 @@ on:
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false

env:
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_AUTHOR_NAME: "ci.datadog-api-spec"

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Get GitHub App token
if: inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
id: get_token
if: inputs.enable-commit-changes
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name == github.repository
with:
fetch-depth: 0
repository: DataDog/datadog-api-client-rust
ref: ${{ inputs.target-branch || github.event.pull_request.head.sha || github.ref }}
token: ${{ inputs.enable-commit-changes && steps.get_token.outputs.token || github.token }}
- uses: actions/checkout@v3
if: github.event.pull_request.head.repo.full_name != github.repository
with:
repository: DataDog/datadog-api-client-rust
ref: ${{ inputs.target-branch || github.ref }}
- name: Install pre-commit
run: python -m pip install pre-commit
- name: set PY
Expand All @@ -66,7 +64,7 @@ jobs:
FROM_REF: ${{ steps.commit_range.outputs.from_ref }}
TO_REF: ${{ steps.commit_range.outputs.to_ref }}
- name: Commit changes
if: failure() && inputs.enable-commit-changes && github.event.pull_request.head.repo.full_name == github.repository
if: ${{ failure() && inputs.enable-commit-changes }}
run: |-
git add -A
git config user.name "${GIT_AUTHOR_NAME}"
Expand All @@ -76,8 +74,6 @@ jobs:
exit 1
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_AUTHOR_NAME: "ci.datadog-api-spec"
- id: pre_commit_schedule
name: Run pre-commit in schedule
if: github.event_name == 'schedule'
Expand Down
Loading