diff --git a/action.yml b/action.yml index 0f6e4cf..9120023 100644 --- a/action.yml +++ b/action.yml @@ -49,5 +49,5 @@ outputs: issueNumber: description: 'If an issue was created, this will be its number' runs: - using: 'node16' + using: 'node20' main: 'dist/index.js' diff --git a/lib/issues.js b/lib/issues.js index 889cac5..49410ae 100644 --- a/lib/issues.js +++ b/lib/issues.js @@ -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. diff --git a/run.js b/run.js index 204d655..bf5cc42 100644 --- a/run.js +++ b/run.js @@ -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') @@ -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)