Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2003cd5
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 12, 2026
7b07f91
Merge pull request #11 from frederickw082922/devel
frederickw082922 Jan 12, 2026
17ebc85
Merge pull request #12 from frederickw082922/devel
frederickw082922 Jan 12, 2026
f642e48
Merge pull request #15 from frederickw082922/devel
frederickw082922 Jan 12, 2026
174efb3
Merge pull request #17 from frederickw082922/devel
frederickw082922 Jan 12, 2026
dd5e3ea
Merge pull request #20 from frederickw082922/devel
frederickw082922 Jan 12, 2026
1e5c2ac
Update GitHub Script action version in workflow
frederickw082922 Jan 12, 2026
3b8fa33
Merge pull request #22 from frederickw082922/devel
frederickw082922 Jan 12, 2026
66241ef
Clarify script section in manual-pre-commit-merge.yml
frederickw082922 Jan 12, 2026
4dcb47e
Merge pull request #24 from frederickw082922/devel
frederickw082922 Jan 12, 2026
5988646
Enhance comments in manual pre-commit merge workflow
frederickw082922 Jan 15, 2026
67f5d6d
Update file change check for pre-commit config
frederickw082922 Jan 15, 2026
5445341
Merge branch 'pre-commit-ci-update-config' into devel
frederickw082922 Jan 15, 2026
4e44886
Merge pull request #26 from frederickw082922/devel
frederickw082922 Jan 15, 2026
ebaf69b
Downgrade ansible-lint version from v26.1.0 to v25.1.0
frederickw082922 Jan 15, 2026
7258fc9
Merge pull request #27 from frederickw082922/pre-commit-ci-update-config
frederickw082922 Jan 15, 2026
41d5e0a
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jan 19, 2026
5f19e60
Refactor manual pre-commit merge workflow steps
frederickw082922 Jan 20, 2026
e08f3ad
Merge pull request #29 from frederickw082922/pre-commit-ci-update-config
frederickw082922 Jan 20, 2026
1ce603b
Simplify auto-merge workflow by removing wait step
frederickw082922 Jan 20, 2026
786dc16
Fix formatting in manual-pre-commit-merge.yml
frederickw082922 Jan 20, 2026
373304e
Remove empty line in manual-pre-commit-merge.yml
frederickw082922 Jan 20, 2026
debdd9d
Refactor auto-merge workflow for pre-commit updates
frederickw082922 Jan 20, 2026
2cb5773
Downgrade ansible-lint version
frederickw082922 Jan 20, 2026
f7248a9
Update ansible-lint version to v26.1.1
frederickw082922 Jan 20, 2026
3ceb611
Add merge labels for automerge action
frederickw082922 Mar 2, 2026
9b7a419
Configure automerge labels in workflow
frederickw082922 Mar 2, 2026
a4aa957
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 9, 2026
47cd768
Remove MERGE_REMOVE_LABELS from workflow
frederickw082922 Mar 10, 2026
ff7e412
Remove MERGE_REMOVE_LABELS from automerge action
frederickw082922 Mar 10, 2026
2e28485
Merge pull request #34 from frederickw082922/pre-commit-ci-update-config
frederickw082922 Mar 10, 2026
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
65 changes: 29 additions & 36 deletions .github/workflows/auto-pre-commit-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,87 +32,80 @@ jobs:
steps:
# Step 1: Verify that the PR was created by the pre-commit-ci bot
# This is a security measure to ensure we only auto-merge bot PRs
# Identifier used to reference this step's outputs in later steps
# Compare the actor (PR creator) with the expected bot username
# Set output variable to true if it's the pre-commit bot
# Set output variable to false for any other user/bot
- name: Check PR author
id: check_author # Identifier used to reference this step's outputs in later steps
id: check_author
run: |
# Compare the actor (PR creator) with the expected bot username
if [[ "${{ github.actor }}" == "pre-commit-ci[bot]" ]]; then
# Set output variable to true if it's the pre-commit bot
echo "is_precommit_bot=true" >> $GITHUB_OUTPUT
else
# Set output variable to false for any other user/bot
echo "is_precommit_bot=false" >> $GITHUB_OUTPUT
fi

# Step 2: Clone the repository to analyze the changes
# This step only runs if the previous step confirmed it's the pre-commit bot
# Use the main branch of the checkout action
# Fetch all history for all branches and tags (needed for git diff)
- name: Checkout code
if: steps.check_author.outputs.is_precommit_bot == 'true'
uses: actions/checkout@main # Use the main branch of the checkout action
uses: actions/checkout@main
with:
fetch-depth: 0 # Fetch all history for all branches and tags (needed for git diff)
fetch-depth: 0

# Step 3: Verify that ONLY the .pre-commit-config.yaml file was modified
# This is a critical safety check to prevent auto-merging unintended changes
# Get the list of files changed between the base branch and the PR head
# origin/${{ github.base_ref }} is the target branch (e.g., main)
# HEAD is the current PR branch
# Check if the ONLY changed file is .pre-commit-config.yaml
# If other files changed, don't auto-merge (requires manual review)
- name: Check if only .pre-commit-config.yaml changed
if: steps.check_author.outputs.is_precommit_bot == 'true'
id: check_changes
run: |
# Get the list of files changed between the base branch and the PR head
# origin/${{ github.base_ref }} is the target branch (e.g., main)
# HEAD is the current PR branch
changed_files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
echo "Changed files: $changed_files" # Log for debugging purposes

# Check if the ONLY changed file is .pre-commit-config.yaml
changed_files=$(git diff --name-only origin/devel...HEAD)
echo "Changed files: $changed_files"
if [[ "$changed_files" == ".pre-commit-config.yaml" ]]; then
echo "only_precommit=true" >> $GITHUB_OUTPUT
else
# If other files changed, don't auto-merge (requires manual review)
echo "only_precommit=false" >> $GITHUB_OUTPUT
fi

# Step 4: Automatically approve the PR
# Only runs if all previous checks passed (bot author + only pre-commit config changed)
# Third-party action for PR approval
- name: Auto-approve PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: hmarr/auto-approve-action@v4 # Third-party action for PR approval
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.BOT_PAT }}

# Step 5: Add an informative comment to the PR
# This provides transparency about what the workflow is doing
# Allows running custom JavaScript in the workflow
- name: Add comment on PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: actions/github-script@main # Allows running custom JavaScript in the workflow
uses: actions/github-script@v8
with:
github-token: ${{ secrets.BOT_PAT }}
script: |
# Use the GitHub REST API to create a comment on the PR
github.rest.issues.createComment({
issue_number: context.issue.number, # PR number from the event context
owner: context.repo.owner, # Repository owner
repo: context.repo.repo, # Repository name
body: "Auto-approved pre-commit version update. Merging after checks pass."
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Auto-approved pre-commit version update. Merging after checks pass.'
})

# Step 6: Wait for all CI/CD checks to complete successfully
# This ensures we don't merge a PR that breaks tests or other quality checks
- name: Wait for all checks to pass
if: steps.check_changes.outputs.only_precommit == 'true'
uses: lewagon/wait-on-check-action@master
with:
ref: ${{ github.event.pull_request.head.sha }} # The commit SHA to check
repo-token: ${{ secrets.BOT_PAT }}
wait-interval: 20 # Check status every 20 seconds
allowed-conclusions: success # Only proceed if all checks succeed (not skipped/neutral)

# Step 7: Automatically merge the PR
# Step 6: Automatically merge the PR
# This is the final step, only executed after all checks pass
# Squash all commits into a single commit on merge
- name: Auto-merge PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: pascalgn/automerge-action@main
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
MERGE_METHOD: squash # Squash all commits into a single commit on merge
MERGE_LABELS: "automerge"
MERGE_METHOD: "squash"
# Other options: merge (creates merge commit), rebase (rebases commits)
64 changes: 28 additions & 36 deletions .github/workflows/manual-pre-commit-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,88 +32,80 @@ jobs:
steps:
# Step 1: Verify that the PR was created by the pre-commit-ci bot
# This is a security measure to ensure we only auto-merge bot PRs
# Identifier used to reference this step's outputs in later steps
# Compare the actor (PR creator) with the expected bot username
# Set output variable to true if it's the pre-commit bot
# Set output variable to false for any other user/bot
- name: Check PR author
id: check_author # Identifier used to reference this step's outputs in later steps
id: check_author
run: |
# Compare the actor (PR creator) with the expected bot username
if [[ "${{ github.actor }}" == "uk-bolly" ]]; then
# Set output variable to true if it's the pre-commit bot
echo "is_precommit_bot=true" >> $GITHUB_OUTPUT
else
# Set output variable to false for any other user/bot
echo "is_precommit_bot=false" >> $GITHUB_OUTPUT
fi

# Step 2: Clone the repository to analyze the changes
# This step only runs if the previous step confirmed it's the pre-commit bot
# Use the main branch of the checkout action
# Fetch all history for all branches and tags (needed for git diff)
- name: Checkout code
if: steps.check_author.outputs.is_precommit_bot == 'true'
uses: actions/checkout@main # Use the main branch of the checkout action
uses: actions/checkout@main
with:
fetch-depth: 0 # Fetch all history for all branches and tags (needed for git diff)
fetch-depth: 0

# Step 3: Verify that ONLY the .pre-commit-config.yaml file was modified
# This is a critical safety check to prevent auto-merging unintended changes
# Get the list of files changed between the base branch and the PR head
# origin/${{ github.base_ref }} is the target branch (e.g., main)
# HEAD is the current PR branch
# Check if the ONLY changed file is .pre-commit-config.yaml
# If other files changed, don't auto-merge (requires manual review)
- name: Check if only .pre-commit-config.yaml changed
if: steps.check_author.outputs.is_precommit_bot == 'true'
id: check_changes
run: |
# Get the list of files changed between the base branch and the PR head
# origin/${{ github.base_ref }} is the target branch (e.g., main)
# HEAD is the current PR branch
changed_files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
echo "Changed files: $changed_files" # Log for debugging purposes

# Check if the ONLY changed file is .pre-commit-config.yaml
changed_files=$(git diff --name-only origin/devel...HEAD)
echo "Changed files: $changed_files"
if [[ "$changed_files" == ".pre-commit-config.yaml" ]]; then
echo "only_precommit=true" >> $GITHUB_OUTPUT
else
# If other files changed, don't auto-merge (requires manual review)
echo "only_precommit=false" >> $GITHUB_OUTPUT
fi

# Step 4: Automatically approve the PR
# Only runs if all previous checks passed (bot author + only pre-commit config changed)
# Third-party action for PR approval
- name: Auto-approve PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: hmarr/auto-approve-action@v4 # Third-party action for PR approval
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.BOT_PAT }}

# Step 5: Add an informative comment to the PR
# This provides transparency about what the workflow is doing
# Allows running custom JavaScript in the workflow
- name: Add comment on PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: actions/github-script@main # Allows running custom JavaScript in the workflow
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
# Use the GitHub REST API to create a comment on the PR
github.rest.issues.createComment({
issue_number: context.issue.number, # PR number from the event context
owner: context.repo.owner, # Repository owner
repo: context.repo.repo, # Repository name
body: "Auto-approved pre-commit version update. Merging after checks pass."
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Auto-approved pre-commit version update. Merging after checks pass.'
})

# Step 6: Wait for all CI/CD checks to complete successfully
# This ensures we don't merge a PR that breaks tests or other quality checks
- name: Wait for all checks to pass
if: steps.check_changes.outputs.only_precommit == 'true'
uses: lewagon/wait-on-check-action@master
with:
ref: ${{ github.event.pull_request.head.sha }} # The commit SHA to check
repo-token: ${{ secrets.BOT_PAT }}
wait-interval: 20 # Check status every 20 seconds
allowed-conclusions: success # Only proceed if all checks succeed (not skipped/neutral)

# Step 7: Automatically merge the PR
# Step 6: Automatically merge the PR
# This is the final step, only executed after all checks pass
# Squash all commits into a single commit on merge
- name: Auto-merge PR
if: steps.check_changes.outputs.only_precommit == 'true'
uses: pascalgn/automerge-action@main
env:

GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
MERGE_METHOD: squash # Squash all commits into a single commit on merge
MERGE_LABELS: "automerge"
MERGE_METHOD: "squash"
# Other options: merge (creates merge commit), rebase (rebases commits)
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
- id: gitleaks

- repo: https://github.com/ansible-community/ansible-lint
rev: v25.12.1
rev: v26.3.0
hooks:
- id: ansible-lint
name: Ansible-lint
Expand All @@ -65,7 +65,7 @@ repos:
# - ansible-core>=2.10.1

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1 # or higher tag
rev: v1.38.0 # or higher tag
hooks:
- id: yamllint
name: Check YAML Lint