Skip to content

Commit

Permalink
fix: set github actions permissions (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk authored Sep 26, 2023
1 parent 0fbe639 commit 782c2f0
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/api-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
name: Run E2E tests
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
checks: write
pull-requests: write
defaults:
run:
working-directory: ./packages/api
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/app-deploy-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ jobs:
build:
name: Build and Test App
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
defaults:
run:
working-directory: ./packages/app
Expand Down Expand Up @@ -65,6 +69,8 @@ jobs:
name: Feature Env, Mainnet+
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: read
with:
targetUrl: ${{ needs.build.outputs.dappUrl }}
default_network_value_for_e2e: "/?network=mainnet"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/app-deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
dappUrl: ${{ steps.deploy.outputs.details_url }}
steps:
Expand Down Expand Up @@ -64,6 +66,8 @@ jobs:
name: Staging Env, Mainnet+
uses: ./.github/workflows/app-e2e.yml
secrets: inherit
permissions:
contents: read
with:
targetUrl: ${{ needs.deploy.outputs.dappUrl }}
default_network_value_for_e2e: "/?network=mainnet"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/app-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/app-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: BE App E2E tests

on:
workflow_call:
secrets:
Expand Down Expand Up @@ -34,6 +35,8 @@ env:
jobs:
e2e:
runs-on: [self-hosted, ci-runner]
permissions:
contents: read
defaults:
run:
working-directory: ./packages/app
Expand Down Expand Up @@ -131,6 +134,8 @@ jobs:
publish:
name: Publish Allure link to GIT
runs-on: ubuntu-latest
permissions:
contents: read
needs: e2e
if: always()
steps:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/nodejs-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,30 @@ env:
Public Domain;
WTFPL;
Unlicense;
UNLICENSED;
# It has to be one line, there must be no space between packages.
EXCLUDE_PACKAGES: [email protected];[email protected];

jobs:
generate-matrix:
name: Lists modules
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- run: |
DIRS=$(find -not \( -path \*node_modules -prune \) -type f -name yarn.lock | xargs dirname | awk -v RS='' -v OFS='","' 'NF { $1 = $1; print "\"" $0 "\"" }')
DIRS=$(find -not \( -path \*node_modules -prune \) -type f -name package.json | xargs dirname | awk -v RS='' -v OFS='","' 'NF { $1 = $1; print "\"" $0 "\"" }')
echo "matrix=[${DIRS}]" >> $GITHUB_OUTPUT
id: set-matrix
license-check:
needs: [generate-matrix]
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
dir: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
Expand All @@ -50,12 +55,11 @@ jobs:
with:
node-version: 18

- name: Install yarn
run: npm install -g yarn license-checker
- name: Install license checker
run: npm install -g license-checker

- name: Install dependencies in ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
run: yarn install
- name: Install dependencies
run: npm ci

- name: Check licenses in ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
createReleaseVersion:
name: Create Release Version
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
releaseVersion: ${{ steps.release.outputs.releaseVersion }}
steps:
Expand Down Expand Up @@ -53,6 +56,8 @@ jobs:
deployBackendToStaging:
name: Deploy Block Explorer backend to staging
runs-on: [self-hosted, default]
permissions:
contents: read
needs: createReleaseVersion
if: ${{ github.ref == 'refs/heads/main' && needs.createReleaseVersion.outputs.releaseVersion != '' }}
steps:
Expand Down Expand Up @@ -109,6 +114,8 @@ jobs:
deployFrontendToStaging:
name: Deploy Block Explorer frontend to staging
runs-on: ubuntu-latest
permissions:
contents: read
needs: createReleaseVersion
if: ${{ github.ref == 'refs/heads/main' && needs.createReleaseVersion.outputs.releaseVersion != '' }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/secrets_scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Leaked Secrets Scan
on: [pull_request]
jobs:
TruffleHog:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
label:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
Expand All @@ -22,6 +24,11 @@ jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down

0 comments on commit 782c2f0

Please sign in to comment.