-
Notifications
You must be signed in to change notification settings - Fork 3
NAID-3322 - Review GitHub Actions NHS Best Practices #310
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
Changes from all commits
4f49f52
57a442e
717f99d
88ffcb2
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 |
|---|---|---|
|
|
@@ -12,16 +12,20 @@ jobs: | |
| tests: | ||
| name: Tests | ||
| uses: ./.github/workflows/test.yml | ||
| permissions: | ||
| contents: read | ||
|
|
||
| generate-build-id: | ||
| name: "Generate Build Id" | ||
| needs: [ tests ] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| build-id: ${{ steps.generate.outputs.buildId }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - id: generate | ||
| working-directory: ./scripts | ||
|
|
@@ -32,9 +36,9 @@ jobs: | |
| chmod +x ./create_build_id.sh | ||
|
|
||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| GIT_BRANCH=PR | ||
| GIT_BRANCH=PR | ||
| elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
| GIT_BRANCH=main | ||
| GIT_BRANCH=main | ||
| fi | ||
|
|
||
| BUILD_ID=$(./create_build_id.sh $GIT_BRANCH ${{ github.run_number }} ${{ github.sha }}) | ||
|
|
@@ -44,12 +48,11 @@ jobs: | |
| publish-docker-image: | ||
| name: "Publish docker image to ECR" | ||
| needs: [ generate-build-id ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| uses: ./.github/workflows/publish.yml | ||
| with: | ||
| directory: . | ||
| repository: nhais | ||
| build-context: . | ||
| build-id: ${{ needs.generate-build-id.outputs.build-id }} | ||
| secrets: inherit | ||
|
|
||
|
|
@@ -63,10 +66,9 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Comment PR | ||
| uses: thollander/actions-comment-pull-request@v3 | ||
| uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 | ||
|
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. the same here as above... doesn't "thollander/actions-comment-pull-request@v3" take the latest version ? or we need specifically v.3.0.1 ?
Collaborator
Author
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. To ensure a specific version is used and prevent the latest version being used in case of malicious updates or security issues with introduced dependencies. Please see: Pin actions to specific versions |
||
| with: | ||
| message: | | ||
| Images built and published to ECR using a Build Id of ${{ needs.generate-build-id.outputs.build-id }} | ||
| comment-tag: images-built | ||
| mode: upsert | ||
|
|
||
| mode: upsert | ||
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.
does not actions/checkout@v4 take the latest version? I am just trying to understand why do we need to pull "checkout@11bd71901bbe5b1630ceea73d27597364c9af683" ? looks a bit scary :) ....
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.
To ensure a specific version is used and prevent the latest version being used in case of malicious updates or security issues with introduced dependencies.
Please see: Pin actions to specific versions