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
34 changes: 21 additions & 13 deletions .github/workflows/gpg-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ on: [pull_request] # Trigger this workflow on pull request events

jobs:
gpg-verify:
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
if: |
github.actor != 'dependabot[bot]' &&
github.actor != 'dependabot-preview[bot]' &&
github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest # Use the latest Ubuntu runner for the job
steps:
- uses: actions/checkout@v4 # Checkout the repository code using the actions/checkout action
Expand All @@ -26,18 +29,23 @@ jobs:

- name: Check GPG verification status # Step to check each commit for GPG signature verification
run: |
# Get the list of commits in the pull request
commits=$(git log --pretty=format:%H origin/${PR_HEAD_REF}..origin/${PR_BASE_REF})

# Check the GPG verification status of each commit
# Get the list of commits in the pull request (head commits not yet in base)
commits=$(git log --pretty=format:%H origin/${PR_BASE_REF}..origin/${PR_HEAD_REF})

if [[ -z "$commits" ]]; then
echo "No commits to verify."
exit 0
fi

# Check the GPG verification status of each commit via the GitHub commit API
for commit in $commits; do
status=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$commit/check-runs \
| jq -r '.check_runs[] | select(.name == "GPG verify") | .conclusion')

# If the GPG verification status is not successful, list the commit and exit with a non-zero status
if [[ "$status" != "success" ]]; then
echo "GPG signature verification failed for commit $commit."
exit 1
verified=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$commit \
| jq -r '.commit.verification.verified')

# If the commit is not verified, list it and exit with a non-zero status
if [[ "$verified" != "true" ]]; then
fi
done
5 changes: 1 addition & 4 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
push:
branches:
- main
- dev

# Scorecard workflow restrictions (enforced when publish_results=true):
# - No workflow-level env vars or defaults
Expand Down Expand Up @@ -40,9 +39,7 @@ jobs:
with:
results_file: results.sarif
results_format: sarif
# Publish results (badge + REST API) only when running on the default
# branch or on a schedule/branch-protection event. Dev-branch runs
# still score the repo but do not overwrite the published badge.
# Publish results (badge + REST API) on main, schedule, and branch_protection_rule events.
publish_results: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'branch_protection_rule' }}

- name: "Upload artifact"
Expand Down
Loading