Fix: 🧪 Testing Bounty: PR #1954 - Fix: 🧪 Testing Bounty: PR #1952 - Fix: 🧪 Testing Bounty: PR #1950 - Fix: 🧪 Testing Bounty: PR #1948 - Fix: 🧪 Testing Bounty: PR #1946 - Fix: 🧪 Testing Bounty: PR #1944 - Fix: 🧪 Testing Bounty: PR #1905 - Fix: 🧪 Testing Bounty: PR #1903 - Fix: 🧪 Testing Bounty: PR #1901 - Fix: 🧪 Testing Bounty: PR #1899 - Fix: 🧪 Testing Bounty: PR #1897 - Fix: 🧪 Testing Bounty: PR #1895 - Fix: 🧪 Testing Bounty: PR #1893 - Fix: 🧪 Testing Bounty: PR #1891 - Fix: 🧪 Testing Bounty: PR #1889 - Fix: 🧪 Testing Bounty: PR #1887 - Fix: 🧪 Testing Bounty: PR #1885 - Fix: 🧪 Testing Bounty: PR #1883 - Fix: 🧪 Testing Bounty: PR #1881 - Fix: 🧪 Testing Bounty: PR #1879 - Fix: 🧪 Testing Bounty: PR #1877 - Fix: 🧪 Testing Bounty: PR #1875 - Fix: 🧪 Testing Bounty: PR #1873 - Fix: 🧪 Testing Bounty: PR #1871 - Fix: 🧪 Testing Bounty: PR #1866 - feat: migrate from Easy Peasy to Zustand for state management (fixes settings and onboarding) #268
Workflow file for this run
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: Create Test Bounty | |
on: | |
pull_request_target: | |
types: [opened, reopened, closed] | |
jobs: | |
create-test-bounty: | |
if: github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: write | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create test bounty issue | |
id: create-issue | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
const prNumber = context.payload.pull_request.number; | |
const prTitle = context.payload.pull_request.title; | |
const prAuthor = context.payload.pull_request.user.login; | |
const prUrl = context.payload.pull_request.html_url; | |
// Read template file | |
let templateContent = fs.readFileSync('.github/ISSUE_TEMPLATE/test-bounty-template.md', 'utf8'); | |
// Skip YAML frontmatter | |
const frontmatterEnd = templateContent.indexOf('---', 3) + 3; | |
templateContent = templateContent.substring(frontmatterEnd); | |
// Replace variables manually | |
const replacedContent = templateContent | |
.replace(/\$\{\{ env\.PR_NUMBER \}\}/g, prNumber) | |
.replace(/\$\{\{ env\.PR_TITLE \}\}/g, prTitle) | |
.replace(/\$\{\{ env\.PR_AUTHOR \}\}/g, prAuthor) | |
.replace(/\$\{\{ env\.PR_URL \}\}/g, prUrl); | |
// Create the issue | |
const issue = await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: `🧪 Testing Bounty: PR #${prNumber} - ${prTitle}`, | |
body: replacedContent, | |
labels: ['testing', 'bounty', 'algora'] | |
}); | |
console.log(`Created issue #${issue.data.number}: ${issue.data.html_url}`); | |
return issue.data.html_url; | |
- name: Comment on PR with issue link | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issueUrl = ${{ steps.create-issue.outputs.result }}; | |
const prNumber = context.payload.pull_request.number; | |
const comment = ` | |
## 🧪 testing bounty created! | |
a testing bounty has been created for this PR: [view testing issue](${issueUrl}) | |
testers will be awarded $20 each for providing quality test reports. please check the issue for testing requirements. | |
`; | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
body: comment | |
}); | |
close-test-bounty: | |
if: github.event.action == 'closed' | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
pull-requests: read | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Find and close test bounty issue | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const prNumber = context.payload.pull_request.number; | |
// Search for issues with the bounty label and PR number in title | |
const issues = await github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: 'bounty', | |
state: 'open' | |
}); | |
const bountyIssue = issues.data.find(issue => | |
issue.title.includes(`PR #${prNumber}`) | |
); | |
if (bountyIssue) { | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: bountyIssue.number, | |
state: 'closed' | |
}); | |
console.log(`Closed test bounty issue #${bountyIssue.number}`); | |
} else { | |
console.log('No matching test bounty issue found'); | |
} |