Skip to content

Commit

Permalink
Merge pull request #94 from bcgov/feat/addPermission
Browse files Browse the repository at this point in the history
feat: add permission to workflow jobs
  • Loading branch information
GraceRuan authored Feb 21, 2025
2 parents 94a011e + 781f75b commit 8e6ea3f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions generators/gh-maven-build/templates/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
jobs:
check_token_expiration:
uses: ./.github/workflows/check-token.yaml
permissions: {}
secrets:
token: ${{ secrets.<%= brokerJwt %> }}
<% if (unitTestsPath) { -%>
Expand Down
1 change: 1 addition & 0 deletions generators/gh-maven-build/templates/check-token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
token:
description: "The Broker token"
required: true
permissions: {}

jobs:
check-jwt:
Expand Down
11 changes: 11 additions & 0 deletions generators/gh-maven-build/templates/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ env:
jobs:
check_token_expiration:
uses: ./.github/workflows/check-token.yaml
permissions: {}
secrets:
token: ${{ secrets.<%= brokerJwt %> }}
deploy-build:
name: Deploy development version
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: check_token_expiration
permissions:
contents: read
packages: read
outputs:
project_version: ${{ steps.set-build-output.outputs.project_version }}
build_guid: ${{ steps.set-build-output.outputs.build_guid }}
Expand Down Expand Up @@ -117,6 +121,9 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs: check_token_expiration
permissions:
contents: read
packages: read
outputs:
project_version: ${{ steps.set-tag-output.outputs.project_version }}
build_guid: ${{ steps.set-tag-output.outputs.build_guid }}
Expand Down Expand Up @@ -187,6 +194,10 @@ jobs:
((needs.deploy-build.result == 'success' && needs.deploy-tag.result == 'skipped') ||
(needs.deploy-build.result == 'skipped' && needs.deploy-tag.result == 'success'))
needs: [deploy-build, deploy-tag]
permissions:
actions: read
packages: read
contents: read
runs-on: ubuntu-latest
steps:
- name: Submit a job to Jenkins
Expand Down

0 comments on commit 8e6ea3f

Please sign in to comment.