Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jean9696 committed Jan 9, 2024
1 parent aa18c18 commit 16152d1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,3 @@ jobs:
- name: Test
id: npm-ci-test
run: npm run ci-test

test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 2000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ author: 'Rayon'
inputs:
token:
description: 'Github token'
required: true
required: false
default: ${{ github.token }}
linearApiKey:
description: 'Linear API key'
required: true
Expand All @@ -22,6 +23,10 @@ inputs:
default: 'dev'
required: false
description: 'Main branch where PRs are merged'
ticketRegex:
default: '\bRAY-\d+\b'
required: false
description: 'Regex to fetch ticket ref'



Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export async function run(): Promise<void> {
try {
const token: string = core.getInput('token')
const apiKey: string = core.getInput('linearApiKey')
const ticketRegex: string = core.getInput('ticketRegex')
const releaseLabelName: string = core.getInput('releaseLabel')
const baseBranch = core.getInput('baseBranch')
const maxPrLength = core.getInput('maxPrLength')
Expand Down Expand Up @@ -47,7 +48,7 @@ export async function run(): Promise<void> {
const linearComment = comments.data.find(
c => c.performed_via_github_app?.name === 'Linear'
)
const ticket = linearComment?.body?.match(/\bRAY-\d+\b/)
const ticket = linearComment?.body?.match(new RegExp(ticketRegex))
if (ticket) {
console.log(`Found ticket ${ticket}`)
}
Expand All @@ -73,12 +74,15 @@ export async function run(): Promise<void> {
const releaseLabel = await (
await linearClient.createIssueLabel({ name: releaseLabelName, parentId })
).issueLabel
if (!releaseLabel) {
throw new Error('Cannot retrieve new version label')
}
for (const ref of linearTickets) {
try {
console.log(`Updating ticket ${ref}`)
const ticket = await linearClient.issue(ref)
await ticket.update({
labelIds: [releaseLabel!.id, ...ticket.labelIds].filter(Boolean)
labelIds: [releaseLabel.id, ...ticket.labelIds].filter(Boolean)
})
} catch (e) {
console.error(e)
Expand Down

0 comments on commit 16152d1

Please sign in to comment.