Skip to content

Updat release process#501

Draft
kumaraksh1 wants to merge 2 commits intomasterfrom
users/kumaraksh/update-release-process
Draft

Updat release process#501
kumaraksh1 wants to merge 2 commits intomasterfrom
users/kumaraksh/update-release-process

Conversation

@kumaraksh1
Copy link
Collaborator

No description provided.

Comment on lines +136 to +172
if: inputs.test_deploy == true && inputs.test_app_name != ''
needs: build-and-push-test-branch
runs-on: ubuntu-latest

steps:
- name: Checkout test branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.test_branch_name }}

- name: Create test package
run: |
mkdir -p test-app
cat > test-app/index.html << EOF
<html>
<body>
<h1>Test Deployment</h1>
<p>Version: ${{ inputs.tag_name }}</p>
<p>Branch: ${{ inputs.test_branch_name }}</p>
<p>Time: $(date)</p>
</body>
</html>
EOF

- name: Test deploy to Azure Web App
uses: ./
with:
app-name: ${{ inputs.test_app_name }}
package: test-app

- name: Test deployment result
run: |
echo "## 🚀 Test Deployment Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Deployed to: **${{ inputs.test_app_name }}**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 Verify at: https://${{ inputs.test_app_name }}.azurewebsites.net" >> $GITHUB_STEP_SUMMARY

Check warning

Code 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 Autofix

AI 1 day ago

In general, to fix this class of problem you should add an explicit permissions block at the workflow or job level that grants only the minimal scopes required. Jobs that only need to read code (for checkout) can typically use contents: read. Jobs that need to push commits or create tags require contents: write, and more specialized operations (e.g., interacting with issues or PRs) should use the corresponding fine-grained permissions.

For this specific workflow, the build-and-push-test-branch job already has permissions: contents: write, which is appropriate because it commits and pushes a branch. The flagged test-deployment job, however, only checks out code and performs a deployment using a local action. There’s no evidence it needs write access to the repository itself. The best fix while preserving existing behavior is to add a permissions block to test-deployment that limits the GITHUB_TOKEN to read-only repository contents. Concretely, in .github/workflows/test-release.yml, within the test-deployment job (around line 135), add:

permissions:
  contents: read

just under the job name (and before or after if: / needs: / runs-on: — order among job keys doesn’t affect semantics). No other code or imports are needed.

Suggested changeset 1
.github/workflows/test-release.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/test-release.yml b/.github/workflows/test-release.yml
--- a/.github/workflows/test-release.yml
+++ b/.github/workflows/test-release.yml
@@ -136,6 +136,8 @@
     if: inputs.test_deploy == true && inputs.test_app_name != ''
     needs: build-and-push-test-branch
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     
     steps:
       - name: Checkout test branch
EOF
@@ -136,6 +136,8 @@
if: inputs.test_deploy == true && inputs.test_app_name != ''
needs: build-and-push-test-branch
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout test branch
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