Skip to content

Commit f35a64e

Browse files
committed
Fixes broken link in issue
1 parent 384ae01 commit f35a64e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.github/checkQNetworkReplyErrorCodeUpdate.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ const checkForUpdate = async ( { github, core, context, dryRun } ) => {
1414
{
1515
log = core;
1616

17-
const { commitId, qNetworkReplyErrorCodes } = await fetchQNetworkReplyErrorCodeListFromGitHub( github );
17+
const { blobId, qNetworkReplyErrorCodes } = await fetchQNetworkReplyErrorCodeListFromGitHub( github );
18+
const blobIdShort = shortenId( blobId );
1819
const diffWithLastUsedVersion = await getDiffWithLastUsedVersion( qNetworkReplyErrorCodes );
1920
if ( !diffWithLastUsedVersion ) {
2021
log.info( 'QNetworkReply error codes list is still up to date' );
2122
return;
2223
}
2324
log.warning( 'QNetworkReply error codes list is outdated!' );
2425

25-
const existingGithubIssues = await githubIssues.searchForExistingGithubIssue( { keywords: [ issueTitleBase, shortenCommitId( commitId ) ], github, context } );
26+
const existingGithubIssues = await githubIssues.searchForExistingGithubIssue( { keywords: [ issueTitleBase, blobIdShort ], github, context } );
2627

2728
if ( existingGithubIssues.total_count === 0 ) {
28-
createNewGithubIssue( { commitId, diffWithLastUsedVersion, github, context, dryRun } );
29+
createNewGithubIssue( { blobId, diffWithLastUsedVersion, github, context, dryRun } );
2930
}
3031
else if ( existingGithubIssues.total_count === 1 ) {
3132
log.info( 'An issue already exists for this update.' );
3233
}
3334
else {
34-
log.warning( `Multiple issues exist for the QNetworkReply error codes update with id ${commitId}:\n${ JSON.stringify( existingGithubIssues, undefined, 4 ) }` );
35+
log.warning( `Multiple issues exist for the QNetworkReply error codes update with id ${blobIdShort}:\n${ JSON.stringify( existingGithubIssues, undefined, 4 ) }` );
3536
}
3637
}
3738
catch ( error ) {
@@ -40,8 +41,8 @@ const checkForUpdate = async ( { github, core, context, dryRun } ) => {
4041
}
4142
};
4243

43-
const shortenCommitId = commitId => {
44-
return commitId.substring( 0, 6 )
44+
const shortenId = id => {
45+
return id.substring( 0, 8 )
4546
};
4647

4748
const fetchQNetworkReplyErrorCodeListFromGitHub = async ( github ) => {
@@ -52,12 +53,12 @@ const fetchQNetworkReplyErrorCodeListFromGitHub = async ( github ) => {
5253
path: 'src/network/access/qnetworkreply.h',
5354
ref: 'dev'
5455
} );
55-
const commitId = response.data.sha;
56+
const blobId = response.data.sha;
5657

5758
const qNetworkReplyHeaderSource = decodeRepoContent( response.data );
5859
const qNetworkReplyErrorCodes = extractQNetworkReplyErrorCodes( qNetworkReplyHeaderSource );
5960

60-
return { commitId, qNetworkReplyErrorCodes };
61+
return { blobId, qNetworkReplyErrorCodes };
6162
};
6263

6364
const fetchQNetworkReplyErrorCodeListFromQt = async () => {
@@ -98,11 +99,11 @@ const getDiffWithLastUsedVersion = async ( qNetworkReplyErrorCodes ) => {
9899
return patch;
99100
};
100101

101-
const createNewGithubIssue = async ( { commitId, diffWithLastUsedVersion, github, context, dryRun } ) => {
102-
const commitIdShort = shortenCommitId( commitId );
103-
const title = `${issueTitleBase} ${commitIdShort}`;
102+
const createNewGithubIssue = async ( { blobId, diffWithLastUsedVersion, github, context, dryRun } ) => {
103+
const blobIdShort = shortenId( blobId );
104+
const title = `${issueTitleBase} ${blobIdShort}`;
104105
const body = 'The `QNetworkReply::NetworkError` codes list has been updated. \n' +
105-
`See [qnetworkreply.h@${commitIdShort}](https://code.qt.io/cgit/qt/qtbase.git/commit/src/network/access/qnetworkreply.h?id=${commitId})` + '\n\n' +
106+
'See https://code.qt.io/cgit/qt/qtbase.git/log/src/network/access/qnetworkreply.h' + '\n\n' +
106107
'## Diff ##' + '\n' +
107108
'```diff' + '\n' +
108109
diffWithLastUsedVersion + '\n' +

0 commit comments

Comments
 (0)