Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/build-targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ jobs:
REPOSITORY: ${{ github.repository }}
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
steps:
- name: Check if protected branch
id: check-branch
run: |
if [[ "$GITHUB_REF_NAME" == "main" ]] || [[ "$GITHUB_REF_NAME" =~ ^[0-9]+\.[0-9]+$ ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We could extract the the ref_name as an environments variable - GH_REF_NAME: ${{ github.ref_name }}

echo "is_protected=true" >> $GITHUB_OUTPUT
else
echo "is_protected=false" >> $GITHUB_OUTPUT
fi
- name: Use role credentials for metrics
id: aws-creds
continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }}
Expand All @@ -117,7 +125,7 @@ jobs:
role-duration-seconds: 900
aws-region: us-east-1
- name: Report failure
if: steps.aws-creds.outcome == 'success'
if: steps.aws-creds.outcome == 'success' && steps.check-branch.outputs.is_protected == 'true'
run: |
aws cloudwatch put-metric-data \
--namespace "GitHub/Workflows" \
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/security-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,10 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "build-targets.yaml",
ref: context.ref
ref: context.ref,
inputs: {
triggered_by: 'workflow'
}
})

handle-failures:
Expand Down