Skip to content

Commit f0e954d

Browse files
committed
fix: Fixing scripts
1 parent acb6b17 commit f0e954d

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

.github/scripts/gopls/create-issue.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const fs = require('fs');
66
* @param {Object} params.github - GitHub API client
77
* @param {Object} params.context - GitHub Actions context
88
* @param {Object} params.core - GitHub Actions core utilities
9-
* @param {string} params.fixedFilesPath - Path to the fixed files list
109
* @returns {Promise<number>} The created issue number
1110
*/
12-
module.exports = async ({ github, context, core, fixedFilesPath }) => {
11+
module.exports = async ({ github, context, core }) => {
1312
try {
13+
const { FIXED_FILES_PATH } = process.env;
1414
// Read the files that were fixed from provided paths
15-
const fixedFiles = fs.readFileSync(fixedFilesPath, 'utf8');
15+
const fixedFiles = fs.readFileSync(FIXED_FILES_PATH, 'utf8');
1616

1717
const issueBody = `## Gopls Quickfix Issues Found
1818

.github/scripts/gopls/create-pr.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ const fs = require('fs');
77
* @param {Object} params.context - GitHub Actions context
88
* @param {Object} params.core - GitHub Actions core utilities
99
* @param {Object} params.exec - GitHub Actions exec utilities
10-
* @param {string} params.issueNumber - The issue number to link to (optional)
11-
* @param {string} params.fixedFilesPath - Path to the fixed files list
1210
* @returns {Promise<number>} The created PR number
1311
*/
14-
module.exports = async ({ github, context, core, exec, issueNumber, fixedFilesPath }) => {
12+
module.exports = async ({ github, context, core, exec }) => {
1513
try {
16-
const fixedFiles = fs.readFileSync(fixedFilesPath, 'utf8');
14+
const { ISSUE_NUMBER, FIXED_FILES_PATH } = process.env;
15+
const fixedFiles = fs.readFileSync(FIXED_FILES_PATH, 'utf8');
1716

1817
// Configure git
1918
await exec.exec('git', ['config', '--local', 'user.email', 'action@github.com']);
@@ -47,7 +46,7 @@ ${fixedFiles}
4746
- Generated by monthly gopls check workflow
4847
4948
### Related Issue
50-
${issueNumber ? `Closes #${issueNumber}` : ''}
49+
${ISSUE_NUMBER ? `Closes #${ISSUE_NUMBER}` : ''}
5150
5251
---
5352
*This PR was automatically generated by the monthly gopls quickfix workflow.*
@@ -67,11 +66,11 @@ ${issueNumber ? `Closes #${issueNumber}` : ''}
6766
console.log(`Created PR #${prNumber}`);
6867

6968
// Link PR to issue if issue was created
70-
if (issueNumber) {
69+
if (ISSUE_NUMBER) {
7170
await github.rest.issues.createComment({
7271
owner: context.repo.owner,
7372
repo: context.repo.repo,
74-
issue_number: parseInt(issueNumber),
73+
issue_number: parseInt(ISSUE_NUMBER),
7574
body: `🔗 **Pull Request Created**
7675
7776
A pull request has been created to address the gopls quickfix issues found in this issue.

.github/workflows/gopls.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040

4141
- name: Run gopls quickfixes
4242
id: gopls_run
43+
timeout-minutes: 30
4344
run: ./.github/scripts/gopls/run.sh
4445

4546
- name: Check for changes
@@ -57,8 +58,7 @@ jobs:
5758
with:
5859
script: |
5960
const createIssue = require('./.github/scripts/gopls/create-issue.js');
60-
const fixedFilesPath = process.env.FIXED_FILES_PATH;
61-
await createIssue({ github, context, core, fixedFilesPath });
61+
await createIssue({ github, context, core });
6262
6363
- name: Create pull request for fixes
6464
if: steps.check-changes.outputs.has_changes == 'true'
@@ -69,9 +69,7 @@ jobs:
6969
with:
7070
script: |
7171
const createPR = require('./.github/scripts/gopls/create-pr.js');
72-
const issueNumber = process.env.ISSUE_NUMBER;
73-
const fixedFilesPath = process.env.FIXED_FILES_PATH;
74-
await createPR({ github, context, core, exec, issueNumber, fixedFilesPath });
72+
await createPR({ github, context, core, exec });
7573
7674
- name: Success message
7775
if: steps.gopls_run.outputs.has_fixes == 'false'

0 commit comments

Comments
 (0)