From 58c9eb05e5ff110c74f2dd74e3b40aac7e529125 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 00:40:03 +0000 Subject: [PATCH 1/3] Initial plan for issue From 26f6848ea47023895409b4a87114f34c6e5f4a58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 00:41:58 +0000 Subject: [PATCH 2/3] Replace direct push with PR creation in README contributors workflow Co-authored-by: deadlydog <1187140+deadlydog@users.noreply.github.com> --- .../workflows/update-readme-contributors.yml | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/.github/workflows/update-readme-contributors.yml b/.github/workflows/update-readme-contributors.yml index fc9a50a..4c7b408 100644 --- a/.github/workflows/update-readme-contributors.yml +++ b/.github/workflows/update-readme-contributors.yml @@ -105,41 +105,18 @@ jobs: } result-encoding: string - - name: Commit and push changes if README was updated + - name: Create Pull Request if README was updated if: steps.update-readme.outputs.result == 'true' - shell: pwsh - run: | - # Check if there are changes to commit - $gitStatus = git status --porcelain - if ([string]::IsNullOrWhiteSpace($gitStatus)) { - Write-Output "No changes to commit. README is already up to date." - exit 0 - } - - # Configure git - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - - # Add, commit and push changes - git add ReadMe.md - git commit -m "docs: update contributors in README [skip ci]" - - # Push changes - retry up to 3 times in case of network issues - $maxRetries = 3 - $retryCount = 0 - - while ($retryCount -lt $maxRetries) { - try { - git push - Write-Output "Successfully pushed changes to the repository." - exit 0 - } - catch { - $retryCount++ - Write-Output "Push failed. Retrying in 5 seconds... (Attempt $retryCount of $maxRetries)" - Start-Sleep -Seconds 5 - } - } - - Write-Output "Failed to push changes after $maxRetries attempts." - exit 1 + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "docs: update contributors in README [skip ci]" + title: "docs: Update contributors in README" + body: | + This PR updates the README.md file with the latest contributors to the project. + + *This is an automated PR created by the update-readme-contributors workflow.* + branch: auto-update-readme-contributors + branch-suffix: timestamp + delete-branch: true + base: main From d00964b4ac9e1c69810fbafa1df45df714721f5c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 May 2025 00:42:37 +0000 Subject: [PATCH 3/3] Add explicit permissions for PR creation Co-authored-by: deadlydog <1187140+deadlydog@users.noreply.github.com> --- .github/workflows/update-readme-contributors.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/update-readme-contributors.yml b/.github/workflows/update-readme-contributors.yml index 4c7b408..742cdc0 100644 --- a/.github/workflows/update-readme-contributors.yml +++ b/.github/workflows/update-readme-contributors.yml @@ -19,6 +19,9 @@ on: jobs: update-contributors: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Checkout the repo