Skip to content

Enable containers to add CAs to the trust store on start up #3608

Enable containers to add CAs to the trust store on start up

Enable containers to add CAs to the trust store on start up #3608

name: PR Validation
on:
pull_request:
# one limitation here is that there's no trigger to re-run any time we "connect" or "disconnect" an issue
types: [opened, edited, labeled, unlabeled, synchronize]
workflow_dispatch:
jobs:
validate-pr:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Validate PR has labels
id: check_labels
run: |
PR_LABELS=$(jq -r '.pull_request.labels | length' $GITHUB_EVENT_PATH)
if [ "$PR_LABELS" -eq "0" ]; then
echo "No labels found on the pull request."
exit 1
fi
- name: Validate PR is linked to an issue
id: check_linked_issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH)
REPO_OWNER=$(jq -r '.repository.owner.login' $GITHUB_EVENT_PATH)
REPO_NAME=$(jq -r '.repository.name' $GITHUB_EVENT_PATH)
# Use GraphQL API to query closingIssuesReferences which detects:
# 1. Manual connections via the sidebar UI
# 2. Keyword-based links (Fixes, Closes, Resolves) in PR body/comments
GRAPHQL_QUERY=$(cat <<EOF
{
"query": "query { repository(owner: \"$REPO_OWNER\", name: \"$REPO_NAME\") { pullRequest(number: $PR_NUMBER) { closingIssuesReferences(first: 10) { totalCount } } } }"
}
EOF
)
LINKED_ISSUES=$(echo "$GRAPHQL_QUERY" | curl -s -H "Authorization: Bearer $GITHUB_TOKEN" -H "Content-Type: application/json" -d @- https://api.github.com/graphql | jq -r '.data.repository.pullRequest.closingIssuesReferences.totalCount')
# If the count is 0 or null, then no linked issues were found
if [ -z "$LINKED_ISSUES" ] || [ "$LINKED_ISSUES" = "null" ] || [ "$LINKED_ISSUES" -eq "0" ]; then
echo "❌ No linked issues found in the pull request."
echo "Please link this PR to an issue using keywords (Fixes #123, Closes #456) or the GitHub UI sidebar."
exit 1
else
echo "✅ Linked issues found: $LINKED_ISSUES"
fi