|
| 1 | +# GitHub Actions Setup |
| 2 | + |
| 3 | +## README Revalidation Workflow |
| 4 | + |
| 5 | +This repository includes a GitHub Action that automatically revalidates challenge README files on speedrunethereum.com whenever they are updated. |
| 6 | + |
| 7 | +### How it works |
| 8 | + |
| 9 | +The workflow (`revalidate-challenge-readme.yml`) triggers when: |
| 10 | + |
| 11 | +1. **Push events** that modify README files on challenge branches |
| 12 | +2. **Merged pull requests** that modify README files targeting challenge branches |
| 13 | + |
| 14 | +**Watched files:** |
| 15 | + |
| 16 | +- `README.md` (root level challenge description) |
| 17 | +- `extension/README.md.args.mjs` (template file) |
| 18 | + |
| 19 | +**Supported branches:** |
| 20 | + |
| 21 | +- Any branch matching the pattern `challenge-*` (e.g., `challenge-tokenization`, `challenge-decentralized-staking`) |
| 22 | + |
| 23 | +### Setup Requirements |
| 24 | + |
| 25 | +To use this workflow, you need to configure the following repository secret: |
| 26 | + |
| 27 | +#### Required Secret |
| 28 | + |
| 29 | +**`REVALIDATION_TOKEN`** |
| 30 | + |
| 31 | +- Description: Authentication token for speedrunethereum.com API |
| 32 | +- Required for: Making revalidation API calls |
| 33 | +- Setup: Go to your repository Settings → Secrets and variables → Actions → Repository secrets |
| 34 | + |
| 35 | +### How the workflow extracts challenge names |
| 36 | + |
| 37 | +The workflow automatically extracts the challenge name from the branch name: |
| 38 | + |
| 39 | +- `challenge-tokenization` → `tokenization` |
| 40 | +- `challenge-decentralized-staking` → `decentralized-staking` |
| 41 | +- `challenge-dex` → `dex` |
| 42 | + |
| 43 | +This extracted name is used to construct the revalidation URL: |
| 44 | + |
| 45 | +``` |
| 46 | +https://speedrunethereum.com/api/revalidate?token=${REVALIDATION_TOKEN}&path=/challenge/${challenge_name} |
| 47 | +``` |
| 48 | + |
| 49 | +### Workflow Features |
| 50 | + |
| 51 | +- ✅ **Automatic triggering** on README changes |
| 52 | +- ✅ **Branch pattern matching** for challenge branches only |
| 53 | +- ✅ **Smart challenge name extraction** from branch names |
| 54 | +- ✅ **Error handling** with proper HTTP status checking |
| 55 | +- ✅ **Detailed logging** of revalidation attempts |
| 56 | +- ✅ **GitHub Actions summary** with status and details |
| 57 | +- ✅ **Support for both direct pushes and merged PRs** |
| 58 | + |
| 59 | +### Troubleshooting |
| 60 | + |
| 61 | +If the workflow fails: |
| 62 | + |
| 63 | +1. **Check the secret**: Ensure `REVALIDATION_TOKEN` is correctly set |
| 64 | +2. **Verify branch name**: Make sure you're on a `challenge-*` branch |
| 65 | +3. **Check file paths**: Ensure you're modifying `README.md` or `extension/README.md.args.mjs` |
| 66 | +4. **Review logs**: Check the GitHub Actions logs for detailed error messages |
| 67 | + |
| 68 | +### Testing the workflow |
| 69 | + |
| 70 | +You can test the workflow by: |
| 71 | + |
| 72 | +1. Making a small change to `README.md` on a challenge branch |
| 73 | +2. Committing and pushing the change |
| 74 | +3. Checking the Actions tab in your GitHub repository |
| 75 | +4. Reviewing the workflow run and summary for success/failure status |
0 commit comments