Skip to content

Conversation

@vladd-bit
Copy link
Member

Reverts #6

Comment on lines +15 to +54
name: 'Submodules Sync'
runs-on: ubuntu-22.04
if: github.actor != 'github-actions[bot]'

defaults:
run:
shell: bash

steps:
- name: Checkout repository with submodules
uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive
persist-credentials: false

- name: Sync submodule URLs
run: |
git submodule sync --recursive

- name: Update submodules
run: |
git -c protocol.version=2 submodule update --init --remote --recursive --jobs 8

- name: Commit and push submodule updates
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}
# Stage only submodule pointer updates and .gitmodules
git add .gitmodules $(git config -f .gitmodules --get-regexp path | awk '{print $2}') || true
if git diff --cached --quiet; then
echo "No submodule pointer changes to commit"
exit 0
fi
git commit -m "chore(submodules): auto-update pointers [skip ci]"
git push

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 30 days ago

To fix the problem, we must add a permissions: block to the workflow to restrict the GitHub Actions GITHUB_TOKEN permissions as tightly as possible, following the principle of least privilege. The workflow commits changes and pushes updates, so it needs contents: write, but no other elevated permissions. This block should be added either at the workflow root (top level) or at the job level; since there is only one job shown, either approach is fine. The simplest fix is to add the following block near the top (before jobs:):

permissions:
  contents: write

This will ensure that the workflow has only the necessary permissions for repository contents and disallow unnecessary privileges.

Suggested changeset 1
.github/workflows/submodule_sync.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/submodule_sync.yml b/.github/workflows/submodule_sync.yml
--- a/.github/workflows/submodule_sync.yml
+++ b/.github/workflows/submodule_sync.yml
@@ -1,5 +1,8 @@
 name: submodules-sync
 
+permissions:
+  contents: write
+
 on:
   push:
     branches: ['**']
EOF
@@ -1,5 +1,8 @@
name: submodules-sync

permissions:
contents: write

on:
push:
branches: ['**']
Copilot is powered by AI and may make mistakes. Always verify output.
@tomolopolis
Copy link
Member

@vladd-bit vladd-bit merged commit 45cb486 into main Oct 30, 2025
10 of 13 checks passed
@vladd-bit vladd-bit deleted the revert-6-CU-869az43jq-distribut-cogstack-es branch October 30, 2025 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants