From 2f4d88f8dd5ec1b0ee82f9d622b1ad56b627a7d0 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Fri, 18 Apr 2025 14:43:19 +0100 Subject: [PATCH] Add explicit permissions to GitHub Actions workflows --- .github/workflows/release.yml | 4 +++- .github/workflows/sync-wiki.yml | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a25e9d..31d9508 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,8 @@ jobs: build: name: Build and Release runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v3 @@ -60,7 +62,7 @@ jobs: prerelease: false body: | Release of version ${{ env.VERSION }} - + See [CHANGELOG.md](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/blob/main/CHANGELOG.md) for details. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index e56b4a3..cea96e4 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -11,6 +11,8 @@ jobs: sync-wiki: name: Sync Wiki to GitHub runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout source code uses: actions/checkout@v3 @@ -23,29 +25,29 @@ jobs: - name: Clone wiki repository run: | git clone https://github.com/${{ github.repository }}.wiki.git wiki - + - name: Sync wiki content run: | # Remove all files from wiki repository except .git find wiki -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} \; - + # Copy .wiki content to wiki repository cp -r .wiki/* wiki/ - + # Go to wiki repository cd wiki - + # Add all changes git add . - + # Check if there are changes to commit if git diff --staged --quiet; then echo "No changes to commit" exit 0 fi - + # Commit changes git commit -m "Sync wiki from source repository" - + # Push changes git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git