# 官方用例 2: actions/checkout@v4 官方 Action 深度验证 # 覆盖: 官方 action 在 Gitea 的兼容性 / 私有仓 clone 认证(GITHUB_TOKEN) / 内容与 commit 完整性 name: Official Action - checkout on: [push] jobs: checkout: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: verify workspace content run: | set -e echo "workspace=$GITHUB_WORKSPACE" ls -la test -f README.md || { echo "FAIL: README.md not found"; exit 1; } echo "OK: repository checked out" - name: verify commit info run: | set -e test -n "$GITHUB_SHA" || { echo "FAIL: GITHUB_SHA empty"; exit 1; } echo "sha=$GITHUB_SHA" git log -1 --oneline git rev-parse HEAD | grep -q "^${GITHUB_SHA}" && echo "OK: HEAD matches GITHUB_SHA"