[Experiment] USD balance for AccountBalance #167
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: Linked Issue | |
on: | |
pull_request: | |
types: [opened, edited] | |
env: | |
VALID_ISSUE_PREFIXES: "CNCT|DASH" | |
jobs: | |
linear: | |
name: Linear | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for linked issue | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const pr = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
}); | |
const body = pr.data.body || ''; | |
const branchName = pr.data.head.ref; | |
const issueRegex = new RegExp(`(${process.env.VALID_ISSUE_PREFIXES})-\\d+`, 'i'); | |
const branchIssueRegex = new RegExp(`(${process.env.VALID_ISSUE_PREFIXES.toLowerCase()})-\\d+`, 'i'); | |
if (!issueRegex.test(body) && !branchIssueRegex.test(branchName)) { | |
core.setFailed( | |
`No valid issue reference found. PR body or branch name must contain an issue ID with one of these prefixes: ${process.env.VALID_ISSUE_PREFIXES}` | |
); | |
return; | |
} | |
const matches = body.match(issueRegex) || branchName.match(branchIssueRegex); | |
console.log(`Found issue reference: ${matches[0]}`); |