CPU Test #794
This file contains hidden or 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: CPU Test | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| schedule: | |
| # Every day at noon and midnight | |
| - cron: '0 0,12 * * *' | |
| jobs: | |
| test-pat: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Create test branch | |
| run: | | |
| echo "test $(date)" > test.txt | |
| git config user.name "agent-lightning-bot" | |
| git config user.email "[email protected]" | |
| git add test.txt | |
| git commit -m "Test commit for PAT" | |
| git branch -M test-pat-branch | |
| git remote set-url origin "https://x-access-token:${BOT_PAT}@github.com/${GITHUB_REPOSITORY}.git" | |
| git push --force -u origin test-pat-branch | |
| env: | |
| BOT_PAT: ${{ secrets.BOT_PAT }} | |
| - name: Attempt to open a PR using the PAT | |
| run: | | |
| API="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls" | |
| DATA=$(jq -n --arg head "test-pat-branch" --arg base "main" \ | |
| --arg title "Test PR from PAT" \ | |
| --arg body "This PR was created via a PAT to verify permissions." \ | |
| '{title:$title, head:$head, base:$base, body:$body}') | |
| curl -sS -X POST "$API" \ | |
| -H "Authorization: token ${BOT_PAT}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -d "$DATA" | tee /tmp/create_pr.json | |
| echo "Response status:" | |
| jq -r '.message // "OK"' /tmp/create_pr.json | |
| env: | |
| BOT_PAT: ${{ secrets.BOT_PAT }} |