Fix: limit github action permission (#5210)

* Fix: limit github action permission

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>

* all limit

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
This commit is contained in:
qiaozp
2022-12-20 10:21:02 +08:00
committed by GitHub
parent 9bd443cded
commit 2899fa6f8f
17 changed files with 106 additions and 32 deletions

View File

@@ -4,11 +4,17 @@ on:
types:
- closed
permissions:
contents: read
jobs:
# align with crossplane's choice https://github.com/crossplane/crossplane/blob/master/.github/workflows/backport.yml
open-pr:
runs-on: ubuntu-20.04
if: github.event.pull_request.merged
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3

View File

@@ -6,6 +6,9 @@ on:
- "v*"
workflow_dispatch: { }
permissions:
contents: read
env:
BUCKET: ${{ secrets.OSS_BUCKET }}
ENDPOINT: ${{ secrets.OSS_ENDPOINT }}

View File

@@ -4,11 +4,18 @@ on:
push:
branches: [ master, release-* ]
permissions:
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read # for github/codeql-action/init to get workflow details
security-events: write # for github/codeql-action/autobuild to send a status report
strategy:
fail-fast: false
matrix:

View File

@@ -8,6 +8,9 @@ on:
- labeled
- unlabeled
permissions:
pull-requests: read
jobs:
check:
runs-on: ubuntu-latest

View File

@@ -1,38 +1,41 @@
name: core-api-test
on:
pull_request:
paths:
- 'apis/**'
- 'pkg/oam/**'
- "hack/apis/**"
branches:
- master
- release-*
pull_request:
paths:
- 'apis/**'
- 'pkg/oam/**'
- "hack/apis/**"
branches:
- master
- release-*
permissions:
contents: read
jobs:
core-api-test:
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
env:
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.49'
with:
go-version: ${{ env.GO_VERSION }}
id: go
core-api-test:
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
env:
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.49'
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Test build kubevela-core-api
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
COMMIT_ID: ${{ github.sha }}
run: |
bash ./hack/apis/clientgen.sh
bash ./hack/apis/sync.sh test
- name: Test build kubevela-core-api
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
COMMIT_ID: ${{ github.sha }}
run: |
bash ./hack/apis/clientgen.sh
bash ./hack/apis/sync.sh test

View File

@@ -11,6 +11,9 @@ on:
- master
- release-*
permissions:
contents: read
env:
# Common versions
GO_VERSION: '1.19'

View File

@@ -13,6 +13,9 @@ on:
- master
- release-*
permissions:
contents: read
env:
# Common versions
GO_VERSION: '1.19'
@@ -21,6 +24,8 @@ env:
jobs:
detect-noop:
permissions:
actions: write
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}

View File

@@ -13,6 +13,9 @@ on:
- master
- release-*
permissions:
contents: read
env:
# Common versions
GO_VERSION: '1.19'
@@ -21,6 +24,8 @@ env:
jobs:
detect-noop:
permissions:
actions: write
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}

View File

@@ -13,6 +13,9 @@ on:
- master
- release-*
permissions:
contents: read
env:
# Common versions
GO_VERSION: '1.19'
@@ -21,6 +24,8 @@ env:
jobs:
detect-noop:
permissions:
actions: write
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}

View File

@@ -11,6 +11,9 @@ on:
- master
- release-*
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
env:
# Common versions
GO_VERSION: '1.19'
@@ -22,6 +25,8 @@ jobs:
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
permissions:
actions: write
steps:
- name: Detect No-op Changes
id: noop
@@ -68,6 +73,9 @@ jobs:
runs-on: ubuntu-20.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
steps:
- name: Setup Go

View File

@@ -5,6 +5,9 @@ on:
issue_comment:
types: [created]
permissions:
contents: read
jobs:
bot:
runs-on: ubuntu-20.04
@@ -32,6 +35,9 @@ jobs:
backport:
runs-on: ubuntu-22.04
if: github.event.issue.pull_request && contains(github.event.comment.body, '/backport')
permissions:
issues: write
pull-requests: write
steps:
- name: Extract Command
id: command

View File

@@ -9,6 +9,9 @@ on:
branches:
- master
- release-*
-
permissions:
contents: read
jobs:
license_check:

View File

@@ -11,6 +11,9 @@ env:
ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
permissions:
contents: read
jobs:
publish-core-images:
runs-on: ubuntu-latest

View File

@@ -7,6 +7,9 @@ on:
tags:
- "v*"
permissions:
contents: read
env:
GO_VERSION: '1.19'

View File

@@ -2,6 +2,9 @@ name: Timed Task
on:
schedule:
- cron: '* * * * *'
permissions: {}
jobs:
clean-image:
runs-on: aliyun

View File

@@ -4,6 +4,9 @@ on:
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
images:
name: Image Scan

View File

@@ -5,12 +5,15 @@ on:
branches:
- master
- release-*
workflow_dispatch: {}
workflow_dispatch: { }
pull_request:
branches:
- master
- release-*
permissions:
contents: read
env:
# Common versions
GO_VERSION: '1.19'
@@ -19,6 +22,8 @@ env:
jobs:
detect-noop:
permissions:
actions: write # for fkirc/skip-duplicate-actions to skip or stop workflow runs
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}