-
Notifications
You must be signed in to change notification settings - Fork 17
Test workflow trigger #111
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| build-and-release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Cache pip dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install build wheel setuptools twine | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| pytest tests/ --cov=src/ --cov-report=xml | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.xml | ||
| fail_ci_if_error: false | ||
|
|
||
| - name: Build package | ||
| run: | | ||
| python -m build | ||
|
|
||
| - name: Verify package | ||
| run: | | ||
| # Check if package files were created | ||
| if [ ! -f "dist/*.whl" ] || [ ! -f "dist/*.tar.gz" ]; then | ||
| echo "❌ Package build failed - missing distribution files" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Package built successfully:" | ||
| ls -la dist/ | ||
|
|
||
| - name: Extract version from tag | ||
| id: version | ||
| run: | | ||
| # Remove 'v' prefix from tag | ||
| VERSION=${GITHUB_REF#refs/tags/} | ||
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo "version_without_v=${VERSION#v}" >> $GITHUB_OUTPUT | ||
| echo "Extracted version: ${VERSION} (${VERSION#v})" | ||
|
|
||
| - name: Verify version consistency | ||
| run: | | ||
| # Check if setup.py version matches tag | ||
| SETUP_VERSION=$(grep 'version=' setup.py | sed 's/.*version="\([^"]*\)".*/\1/') | ||
| INIT_VERSION=$(grep '__version__' src/story_protocol_python_sdk/__init__.py | sed "s/.*__version__ = \"\([^']*\)\".*/\1/") | ||
| TAG_VERSION="${{ steps.version.outputs.version_without_v }}" | ||
|
|
||
| echo "Setup.py version: $SETUP_VERSION" | ||
| echo "Init.py version: $INIT_VERSION" | ||
| echo "Tag version: $TAG_VERSION" | ||
|
|
||
| if [ "$SETUP_VERSION" != "$TAG_VERSION" ]; then | ||
| echo "❌ Setup.py version ($SETUP_VERSION) doesn't match tag version ($TAG_VERSION)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$INIT_VERSION" != "$TAG_VERSION" ]; then | ||
| echo "❌ Init.py version ($INIT_VERSION) doesn't match tag version ($TAG_VERSION)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Version consistency verified" | ||
|
|
||
| - name: Create Release | ||
| id: create_release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ steps.version.outputs.version }} | ||
| release_name: Release ${{ steps.version.outputs.version }} | ||
| body: | | ||
| ## What's Changed | ||
| This release implements enhancements to improve the functionality of the WIP Module and overall testing coverage. | ||
|
|
||
| ## Features & Enhancements | ||
|
|
||
| ### WIP Module | ||
| - Enhanced test coverage for WIP token approval and transferFrom functionality | ||
| - Added comprehensive negative test cases for WIP transfers | ||
| - Implemented testing with multiple wallet configurations | ||
| - Added validation for transfer to zero address and contract address scenarios | ||
|
|
||
| ### Testing Improvements | ||
| - Extended integration test coverage | ||
| - Added edge case testing for token operations | ||
| - Improved error handling validation | ||
| - Enhanced test reliability across multiple wallet scenarios | ||
|
|
||
| ## Breaking Changes | ||
| None | ||
|
|
||
| ## Installation | ||
| ```bash | ||
| pip install story_protocol_python_sdk==${{ steps.version.outputs.version_without_v }} | ||
| ``` | ||
|
|
||
| ## Development | ||
| ```bash | ||
| git clone https://github.com/${{ github.repository }}.git | ||
| cd python-sdk | ||
| git checkout ${{ steps.version.outputs.version }} | ||
| pip install -e . | ||
| ``` | ||
|
|
||
| ## Changelog | ||
| - [Full Changelog](https://github.com/${{ github.repository }}/compare/v0.3.14...${{ steps.version.outputs.version }}) | ||
|
|
||
| ## Assets | ||
| This release includes: | ||
| - Source distribution (.tar.gz) | ||
| - Wheel distribution (.whl) | ||
| - Full source code | ||
| draft: false | ||
| prerelease: ${{ contains(steps.version.outputs.version, 'rc') || contains(steps.version.outputs.version, 'alpha') || contains(steps.version.outputs.version, 'beta') }} | ||
|
|
||
| - name: Upload Release Assets | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./dist/story_protocol_python_sdk-${{ steps.version.outputs.version_without_v }}-py3-none-any.whl | ||
| asset_name: story_protocol_python_sdk-${{ steps.version.outputs.version_without_v }}-py3-none-any.whl | ||
| asset_content_type: application/zip | ||
|
|
||
| - name: Upload Source Distribution | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./dist/story_protocol_python_sdk-${{ steps.version.outputs.version_without_v }}.tar.gz | ||
| asset_name: story_protocol_python_sdk-${{ steps.version.outputs.version_without_v }}.tar.gz | ||
| asset_content_type: application/gzip | ||
|
|
||
| - name: Upload Source Code (ZIP) | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| asset_path: ./dist/story_protocol_python_sdk-${{ steps.version.outputs.version_without_v }}.tar.gz | ||
| asset_name: Source code (tar.gz) | ||
| asset_content_type: application/gzip | ||
|
|
||
| - name: Success Message | ||
| run: | | ||
| echo "🎉 Release ${{ steps.version.outputs.version }} created successfully!" | ||
| echo "📦 Package built and uploaded" | ||
| echo "🏷️ GitHub release created" | ||
| echo "📋 Assets uploaded" | ||
| echo "" | ||
| echo "View release at: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}" |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,211 @@ | |||||||||||||||||||||||||||||
| name: test publish workflow | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||||||||
| version_type: | |||||||||||||||||||||||||||||
| type: choice | |||||||||||||||||||||||||||||
| description: version to be published | |||||||||||||||||||||||||||||
| options: | |||||||||||||||||||||||||||||
| - major | |||||||||||||||||||||||||||||
| - minor | |||||||||||||||||||||||||||||
| - patch | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| Timestamp: | |||||||||||||||||||||||||||||
| uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| lint: | |||||||||||||||||||||||||||||
| needs: Timestamp | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.12' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install flake8 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run flake8 | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| flake8 . | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| test: | |||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+40
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
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 AutofixAI 6 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/test-publish.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| needs: [Timestamp, lint] | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Cache pip dependencies | |||||||||||||||||||||||||||||
| uses: actions/cache@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install pytest pytest-cov | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run tests | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| pytest tests/ --cov=src/ --cov-report=xml | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Upload coverage to Codecov | |||||||||||||||||||||||||||||
| uses: codecov/codecov-action@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| file: ./coverage.xml | |||||||||||||||||||||||||||||
| fail_ci_if_error: false | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| build: | |||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+80
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
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 AutofixAI 6 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/test-publish.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| needs: [Timestamp, lint, test] | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| python-version: ["pypy3.9", "pypy3.10", "3.9", "3.10", "3.11", "3.12"] | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Cache pip dependencies | |||||||||||||||||||||||||||||
| uses: actions/cache@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install setuptools wheel build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Build package | |||||||||||||||||||||||||||||
| run: python -m build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Upload build artifacts | |||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| name: dist-${{ matrix.python-version }} | |||||||||||||||||||||||||||||
| path: dist/ | |||||||||||||||||||||||||||||
| retention-days: 1 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| test-publish: | |||||||||||||||||||||||||||||
|
Comment on lines
+81
to
+120
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
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 AutofixAI 6 months ago To fix the problem, you should add a
Suggested changeset
1
.github/workflows/test-publish.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| needs: [Timestamp, build, lint, test] | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| # This job simulates the publish process without actually publishing | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python 3.12 | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: "3.12" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Cache pip dependencies | |||||||||||||||||||||||||||||
| uses: actions/cache@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install setuptools wheel build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Simulate version update | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| VERSION_TYPE: ${{ github.event.inputs.version_type }} | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "🧪 TESTING: Would run version update with type: $VERSION_TYPE" | |||||||||||||||||||||||||||||
| echo "Current branch: $(git branch --show-current)" | |||||||||||||||||||||||||||||
| echo "Current commit: $(git rev-parse HEAD)" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # Show what would be changed | |||||||||||||||||||||||||||||
| if [ -f "update_version.py" ]; then | |||||||||||||||||||||||||||||
| echo "✅ update_version.py exists and is executable" | |||||||||||||||||||||||||||||
| python update_version.py --help 2>/dev/null || echo "⚠️ No help available for update_version.py" | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| echo "❌ update_version.py not found" | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Simulate package building | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "🧪 TESTING: Would build package for publishing" | |||||||||||||||||||||||||||||
| python -m build | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # Validate built package | |||||||||||||||||||||||||||||
| if [ -f dist/*.whl ] && [ -f dist/*.tar.gz ]; then | |||||||||||||||||||||||||||||
| echo "✅ Package build successful" | |||||||||||||||||||||||||||||
| ls -la dist/ | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| echo "❌ Package build failed" | |||||||||||||||||||||||||||||
| exit 1 | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Simulate Git operations | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "🧪 TESTING: Would perform Git operations" | |||||||||||||||||||||||||||||
| echo "Current git status:" | |||||||||||||||||||||||||||||
| git status --porcelain | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| echo "Would commit version changes to setup.py" | |||||||||||||||||||||||||||||
| echo "Would create git tag" | |||||||||||||||||||||||||||||
| echo "Would push to current branch: $(git branch --show-current)" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # Show what files would be committed | |||||||||||||||||||||||||||||
| if [ -f "setup.py" ]; then | |||||||||||||||||||||||||||||
| echo "setup.py contents:" | |||||||||||||||||||||||||||||
| cat setup.py | grep -A 2 -B 2 "version=" || echo "No version field found" | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Simulate PyPI publishing | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "🚫 PyPI publishing disabled for testing" | |||||||||||||||||||||||||||||
| echo "Would publish version: $(grep 'version=' setup.py | sed 's/.*version="\([^"]*\)".*/\1/' 2>/dev/null || echo 'unknown')" | |||||||||||||||||||||||||||||
| echo "Would push to branch: $(git branch --show-current)" | |||||||||||||||||||||||||||||
| echo "Would create tag: v$(grep 'version=' setup.py | sed 's/.*version="\([^"]*\)".*/\1/' 2>/dev/null || echo 'unknown')" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| echo "" | |||||||||||||||||||||||||||||
| echo "🎉 TEST COMPLETED SUCCESSFULLY!" | |||||||||||||||||||||||||||||
| echo "This workflow simulates the publish process without making actual changes." | |||||||||||||||||||||||||||||
| echo "To test the real publish workflow, use publish-package.yml on the main branch." | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Cleanup test artifacts | |||||||||||||||||||||||||||||
| if: always() | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "🧹 Cleaning up test artifacts" | |||||||||||||||||||||||||||||
| rm -rf dist/ build/ *.egg-info/ | |||||||||||||||||||||||||||||
| echo "Cleanup completed" | |||||||||||||||||||||||||||||
|
Comment on lines
+121
to
+211
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium test
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 AutofixAI 6 months ago To fix the problem, add an explicit
Suggested changeset
1
.github/workflows/test-publish.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium test
Copilot Autofix
AI 6 months ago
To fix the problem, add a
permissionskey at the root of the workflow file, immediately after thenameand before theonblock. This will apply the specified permissions to all jobs in the workflow unless overridden at the job level. Since the jobs in this workflow only check out code, run linting, tests, and upload coverage (and do not appear to require any write permissions), the minimal required permission is likelycontents: read. This restricts theGITHUB_TOKENto read-only access to repository contents, which is sufficient for these operations. If any job later requires additional permissions, they can be granted at the job level.Steps:
permissions:block after thename:line and before theon:block in.github/workflows/test-publish.yml.contents: readas the minimal required permission.