Skip to content

Commit

Permalink
fix: use current branch templates for PR runs
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Mar 2, 2024
1 parent 60372e7 commit 7d96317
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ module.exports.stringifiedIssueTemplate = async function stringifiedIssueTemplat
const response = await client.repos.getContents({
owner: options.owner,
repo: options.repo,
path: `.github/ISSUE_TEMPLATE/${options.template}`
path: `.github/ISSUE_TEMPLATE/${options.template}`,
ref: options.ref || 'main'
})

// check that we're not trying to parse a file that doesn't exist. If we are, throw.
Expand Down
4 changes: 3 additions & 1 deletion run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict'
const util = require('node:util')
const core = require('@actions/core')
const github = require('@actions/github')
const list = require('safe-parse-list')
Expand Down Expand Up @@ -71,7 +72,8 @@ const conversions = require('./lib/conversions')
try {
const userProvidedIssueTemplate = await issues.stringifiedIssueTemplate(client, {
...repo,
template: issueTemplate
template: issueTemplate,
ref: github.context.payload?.pull_request?.head?.ref || github.context.payload?.repository?.default_branch || 'main'
})
template = conversions.convert(userProvidedIssueTemplate)
template = ejs.compile(userProvidedIssueTemplate)
Expand Down

0 comments on commit 7d96317

Please sign in to comment.