Bump actions/checkout from 4.1.7 to 4.2.2 #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test GitBot Config Action | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Run GitBot Config | |
uses: ./ | |
- name: Check Git configuration | |
run: | | |
expected_name="github-actions[bot]" | |
expected_email="41898282+github-actions[bot]@users.noreply.github.com" | |
actual_name=$(git config --get user.name) | |
actual_email=$(git config --get user.email) | |
if [ "$actual_name" = "$expected_name" ] && [ "$actual_email" = "$expected_email" ]; then | |
echo "✅ Success: Git user name and email are correctly set" | |
else | |
echo "❌ Failure: Git user configuration is incorrect" | |
echo "Expected name: $expected_name" | |
echo "Actual name: $actual_name" | |
echo "Expected email: $expected_email" | |
echo "Actual email: $actual_email" | |
exit 1 | |
fi | |
- name: Test Git operations | |
run: | | |
# Create a test file | |
echo "Test content" > test_file.txt | |
# Stage the file | |
git add test_file.txt | |
# Commit the file | |
git commit -m "Test commit" | |
# Check if the commit was successful | |
commit_info=$(git log -1 --pretty=format:"%an <%ae>") | |
expected_info="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | |
if [ "$commit_info" = "$expected_info" ]; then | |
echo "✅ Success: Commit was made with the correct user information" | |
else | |
echo "❌ Failure: Commit does not have the correct user information" | |
echo "Expected: $expected_info" | |
echo "Actual: $commit_info" | |
exit 1 | |
fi | |
- name: Calculate SHA256 | |
id: sha256 | |
run: | | |
REPO_ROOT=$(git rev-parse --show-toplevel) | |
HASH=$(find "$REPO_ROOT" -type f -not -path '*/\.git/*' -print0 | sort -z | xargs -0 sha256sum | sha256sum | awk '{print $1}') | |
echo "digest=sha256:$HASH" >> $GITHUB_OUTPUT | |
- name: Create attestation JSON | |
run: | | |
cat << EOF > attestation.json | |
{ | |
"subject": "${{ github.repository }}", | |
"digest": "${{ steps.sha256.outputs.digest }}", | |
"timestamp": "$(date -u +'%Y-%m-%dT%H:%M:%SZ')", | |
"gitConfig": { | |
"name": "$(git config --get user.name)", | |
"email": "$(git config --get user.email)" | |
} | |
} | |
EOF | |
- name: Upload attestation | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: attestation | |
path: attestation.json | |
if-no-files-found: error |