forked from dell/csm-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from mgandharva/spell-test-autofix
code updated
- Loading branch information
Showing
2 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
name: Spellchecking Final Autofix | ||
name: Automatic Spell Check and Correction | ||
|
||
on: | ||
workflow_dispatch: | ||
repository_dispatch: | ||
types: [spell-check-workflow] | ||
types: [trigger-spell-check-autofix] | ||
|
||
jobs: | ||
codespell: | ||
name: Check spelling with codespell and autofix | ||
name: Perform Spell Check and Apply Fixes | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8] # Define the Python version here | ||
|
||
steps: | ||
- name: Checkout code | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Import GPG key | ||
- name: Import GPG Key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.CSM_GPG_PRIVATE_KEY }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_tag_gpgsign: true | ||
git_config_global: true | ||
gpg_private_key: ${{ secrets.CSM_GPG_PRIVATE_KEY }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_tag_gpgsign: true | ||
git_config_global: true | ||
|
||
- name: Set up Python | ||
- name: Set Up Python Environment | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
- name: Install Codespell | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install codespell | ||
- name: Check and fix spelling with codespell | ||
- name: Run Codespell Autofix | ||
run: | | ||
chmod +x .github/workflows/Spell-check-autofix/codespell-autofix.sh | ||
./.github/workflows/Spell-check-autofix/codespell-autofix.sh | ||
- name: Check for uncommitted changes | ||
- name: Check for Uncommitted Changes | ||
id: check_changes | ||
run: | | ||
git status | ||
|
@@ -50,28 +51,38 @@ jobs: | |
echo "CHANGES_DETECTED=false" >> $GITHUB_ENV | ||
fi | ||
- name: Print changes detected | ||
- name: Print Changes Detected | ||
run: | | ||
echo "Changes detected: ${{ env.CHANGES_DETECTED }}" | ||
- name: Commit and push changes | ||
- name: Commit and Push Changes | ||
if: env.CHANGES_DETECTED == 'true' | ||
run: | | ||
git add . | ||
git commit -m "Autofix spelling issues" | ||
- uses: actions/[email protected] | ||
- name: Generate GitHub App Token | ||
uses: actions/[email protected] | ||
id: generate-token | ||
if: env.CHANGES_DETECTED == 'true' | ||
with: | ||
app-id: ${{ vars.CSM_RELEASE_APP_ID }} | ||
private-key: ${{ secrets.CSM_RELEASE_APP_PRIVATE_KEY }} | ||
|
||
- name: Create Pull Request | ||
- name: Create Pull Request with Autofixes | ||
if: env.CHANGES_DETECTED == 'true' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
branch: autofix-spelling | ||
title: 'Autofix spelling issues' | ||
body: "This pull request was created automatically by a GitHub Action that fixes spelling errors." | ||
branch: spellcheck-fixes | ||
title: 'Automated Spelling Corrections Applied' | ||
body: | | ||
This pull request was created automatically by a GitHub Action that fixes spelling errors across multiple files. | ||
**Summary of changes:** | ||
- Identified and corrected common spelling mistakes | ||
- Ensured consistency and accuracy in documentation files | ||
Please review the changes to confirm their accuracy and approve the PR. | ||
sign-commits: true | ||
delete-branch: true |