-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
ci: harden GitHub Actions workflows with least-privilege permissions #15772
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -4,8 +4,6 @@ on: pull_request_target | |
|
|
||
| permissions: | ||
| pull-requests: write | ||
| checks: write | ||
| statuses: write | ||
|
|
||
| jobs: | ||
| check: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,10 @@ on: | |
| types: | ||
| - closed | ||
|
|
||
| permissions: | ||
| contents: read | ||
| actions: write | ||
|
|
||
| jobs: | ||
| cleanup: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,14 +87,18 @@ jobs: | |
| - name: Publish to VSCode Marketplace | ||
| if: steps.vscode-published.outputs.published == 'true' | ||
| working-directory: ./packages/language-tools/vscode | ||
| env: | ||
| VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} | ||
| run: | | ||
| npx vsce publish -p ${{ secrets.VSCE_TOKEN }} --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64 | ||
| npx vsce publish -p "$VSCE_TOKEN" --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64 | ||
|
|
||
| - name: Publish to OpenVSX | ||
| if: steps.vscode-published.outputs.published == 'true' | ||
| working-directory: ./packages/language-tools/vscode | ||
| env: | ||
| OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }} | ||
| run: | | ||
| npx ovsx publish -p ${{ secrets.OVSX_TOKEN }} --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64 | ||
| npx ovsx publish -p "$OVSX_TOKEN" --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This. I didn't know it was possible, is there some GitHub reference about it? |
||
|
|
||
| - name: Restore root package.json and node_modules | ||
| if: steps.vscode-published.outputs.published == 'true' | ||
|
|
@@ -113,6 +117,9 @@ jobs: | |
| if: steps.changesets.outputs.published == 'true' | ||
| env: | ||
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
| uses: Ilshidur/action-discord@d2594079a10f1d6739ee50a2471f0ca57418b554 # 0.4.0 | ||
| with: | ||
| args: "${{ steps.message.outputs.DISCORD_MESSAGE }}" | ||
| DISCORD_MESSAGE: ${{ steps.message.outputs.DISCORD_MESSAGE }} | ||
| run: | | ||
| jq -n --arg content "$DISCORD_MESSAGE" '{content: $content}' | \ | ||
| curl -X POST "$DISCORD_WEBHOOK" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d @- | ||
|
Comment on lines
+120
to
+125
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move this change to another PR? We don't know if this change will work |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we changing here? I think this isn't mentioned in the PR description