diff --git a/.github/actions/update-precommit/action.yml b/.github/actions/update-precommit/action.yml deleted file mode 100644 index e3bb48d56..000000000 --- a/.github/actions/update-precommit/action.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: 'Update Pre-commit Hooks' -description: 'Updates pre-commit hook versions and creates a PR if changes are detected' -inputs: - token: - description: 'GitHub token for creating PRs' - required: true - python-version: - description: 'Python version to use' - required: false - default: '3.14' - -runs: - using: composite - steps: - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python-version }} - - name: Install pre-commit - shell: bash - run: pip install pre-commit - - name: Update pre-commit hooks - shell: bash - run: | - pre-commit autoupdate > /tmp/autoupdate.log 2>&1 - cat /tmp/autoupdate.log - - name: Check for changes - id: changes - shell: bash - run: | - if git diff --quiet .pre-commit-config.yaml; then - echo "changed=false" >> $GITHUB_OUTPUT - else - echo "changed=true" >> $GITHUB_OUTPUT - fi - - name: Create Pull Request - if: steps.changes.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ inputs.token }} - commit-message: "[pre-commit] Update hooks versions" - title: "[pre-commit] Update hooks versions" - committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - body: | - 🤖 This PR was created automatically by the update-pre-commit workflow. - branch: update-pre-commit-hooks - base: master - delete-branch: true - labels: | - dependencies diff --git a/.github/workflows/update-pre-commit.yml b/.github/workflows/update-pre-commit.yml index fc5e97ec4..ccf995c52 100644 --- a/.github/workflows/update-pre-commit.yml +++ b/.github/workflows/update-pre-commit.yml @@ -6,20 +6,22 @@ on: workflow_dispatch: permissions: - contents: write - pull-requests: write - actions: write - checks: write - repository-projects: write + contents: read + pull-requests: read jobs: update-pre-commit: if: ${{ github.repository == 'learning-process/parallel_programming_course' }} runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - - name: Checkout repository - uses: actions/checkout@v6 - name: Update pre-commit hooks - uses: ./.github/actions/update-precommit + uses: tagdots/update-pre-commit-action@1.0.28 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - token: ${{ secrets.GITHUB_TOKEN }} + file: .pre-commit-config.yaml + dry-run: false + open-pr: true