Skip to content

Commit

Permalink
Update postTestBuildComment action to include a link to the workflow run
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Dec 1, 2023
1 parent 847a717 commit a5a17db
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ function getTestBuildMessage() {
| ${androidQRCode} | ${iOSQRCode} |
| Desktop :computer: | Web :spider_web: |
| ${desktopLink} | ${webLink} |
| ${desktopQRCode} | ${webQRCode} |`;
| ${desktopQRCode} | ${webQRCode} |

---

:eyes: [View the workflow run that generated this build](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) :eyes:
`;

return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ function getTestBuildMessage() {
| ${androidQRCode} | ${iOSQRCode} |
| Desktop :computer: | Web :spider_web: |
| ${desktopLink} | ${webLink} |
| ${desktopQRCode} | ${webQRCode} |`;
| ${desktopQRCode} | ${webQRCode} |
---
:eyes: [View the workflow run that generated this build](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) :eyes:
`;

return message;
}
Expand Down
13 changes: 10 additions & 3 deletions tests/unit/postTestBuildComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const mockCreateComment = jest.fn();
jest.mock('@actions/github', () => ({
context: {
repo: {
repo: 'repo',
owner: 'Expensify',
repo: 'App',
},
runId: 1234,
},
}));

Expand All @@ -33,7 +35,12 @@ const message = `:test_tube::test_tube: Use the links below to test this adhoc b
| ${androidQRCode} | ${iOSQRCode} |
| Desktop :computer: | Web :spider_web: |
| ${desktopLink} | ${webLink} |
| ${desktopQRCode} | ${webQRCode} |`;
| ${desktopQRCode} | ${webQRCode} |
---
:eyes: [View the workflow run that generated this build](https://github.com/Expensify/App/actions/runs/1234) :eyes:
`;

describe('Post test build comments action tests', () => {
beforeAll(() => {
Expand All @@ -55,6 +62,6 @@ describe('Post test build comments action tests', () => {
GithubUtils.createComment.mockResolvedValue(true);
ghAction();
expect(GithubUtils.createComment).toBeCalledTimes(1);
expect(GithubUtils.createComment).toBeCalledWith('repo', 12, message);
expect(GithubUtils.createComment).toBeCalledWith('App', 12, message);
});
});

0 comments on commit a5a17db

Please sign in to comment.