Skip to content

Auto update DLLs #3007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Auto update DLLs #3007

wants to merge 2 commits into from

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Jul 30, 2025

Description of Changes

API and ABI breaking changes

Expected complexity level and risk

Testing

Comment on lines +15 to +90
runs-on: ubuntu-latest

steps:
- name: Set up GitHub CLI
uses: actions/setup-gh@v4

- name: Authenticate GitHub CLI
run: gh auth login --with-token <<< "${{secrets.UNITY_SDK_TOKEN}}"

- name: Set SpacetimeDB ref
run: |
echo "SPACETIMEDB_REF=${{ github.event.inputs.github_ref || 'master' }}" >> $GITHUB_ENV

- name: Checkout SpacetimeDB
uses: actions/checkout@v4
with:
path: SpacetimeDB
ref: ${{ env.SPACETIMEDB_REF }}

- name: Set SpacetimeDB sha
run: |
cd SpacetimeDB
echo "SPACETIMEDB_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Checkout C#/Unity SDK
uses: actions/checkout@v4
with:
repository: clockworklabs/com.clockworklabs.spacetimedbsdk
token: ${{secrets.UNITY_SDK_TOKEN}}
path: com.clockworklabs.spacetimedbsdk

- name: Update DLLs
run: |
cd SpacetimeDB/crates/bindings-csharp
dotnet pack

- name: Copy DLLs
run: |
cd com.clockworklabs.spacetimedbsdk
git checkout -B bot/update-dlls origin/master
bash tools~/write-nuget-config.sh ../SpacetimeDB
dotnet restore

- name: Update .meta files
run: |
cd com.clockworklabs.spacetimedbsdk/packages
# find any new untracked directories, which indicate that we've imported a new version of the DLLs
NEW_DIR="$(cd spacetimedb.bsatn.runtime && git ls-files --others --exclude-standard . | cut -d'/' -f1 | sort -u)"
if test -z "${NEW_DIR}"; then
echo "No meta files to update"
else
OLD_DIR="$(cd spacetimedb.bsatn.runtime && git ls-files . | cut -d'/' -f1 | sort -u)"
for file in $(find . -name '*.meta'); do
mv "$file" "${file/$OLD_DIR/$NEW_DIR}";
done
rm -rf "$OLD_DIR"
fi

- name: Commit Changes
run: |
cd com.clockworklabs.spacetimedbsdk/packages
git add .
git commit -m "Update DLLs from SpacetimeDB commit $SPACETIMEDB_SHA" || echo "No changes to commit"
git push -u origin bot/update-dlls

- name: Create or update PR
env:
GH_TOKEN: ${{ secrets.UNITY_SDK_TOKEN }}
run: |
cd com.clockworklabs.spacetimedbsdk/packages
gh pr create --title 'Update DLLs' --base master --head bot/update-dlls || echo 'PR already exists'
gh pr edit bot/update-dlls --body-file - <<EOF
This automated PR updates our DLLs.

Triggered by commit: https://github.com/${{ github.repository }}/commit/${SPACETIMEDB_SHA}
EOF

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 19 days ago

To fix the issue, add a permissions block at the root of the workflow file to explicitly define the least privileges required for the workflow. Based on the actions performed in the workflow, the following permissions are necessary:

  • contents: read for reading repository contents.
  • pull-requests: write for creating and updating pull requests.

This ensures that the workflow has only the permissions it needs to complete its tasks, reducing the risk of unauthorized actions.


Suggested changeset 1
.github/workflows/update-dlls.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/update-dlls.yml b/.github/workflows/update-dlls.yml
--- a/.github/workflows/update-dlls.yml
+++ b/.github/workflows/update-dlls.yml
@@ -12,2 +12,6 @@
 
+permissions:
+  contents: read
+  pull-requests: write
+
 jobs:
EOF
@@ -12,2 +12,6 @@

permissions:
contents: read
pull-requests: write

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant