Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use consistent protocol in end user message #42

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1772,13 +1772,17 @@ function getApps() {
function postDiffComment(diffs) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let protocol = 'https';
if (PLAINTEXT) {
protocol = 'http';
}
const { owner, repo } = github.context.repo;
const sha = (_b = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.head) === null || _b === void 0 ? void 0 : _b.sha;
const commitLink = `https://github.com/${owner}/${repo}/pull/${github.context.issue.number}/commits/${sha}`;
const shortCommitSha = String(sha).substr(0, 7);
const prefixHeader = `## ArgoCD Diff on ${ENV}`;
const diffOutput = diffs.map(({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](https://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
const diffOutput = diffs.map(({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](${protocol}://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
YAML generation: ${error ? ' Error 🛑' : 'Success 🟢'}
App sync status: ${app.status.sync.status === 'Synced' ? 'Synced ✅' : 'Out of Sync ⚠️ '}
${error
Expand Down
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ interface Diff {
error?: ExecResult;
}
async function postDiffComment(diffs: Diff[]): Promise<void> {
let protocol = 'https';
if (PLAINTEXT) {
protocol = 'http';
}

const { owner, repo } = github.context.repo;
const sha = github.context.payload.pull_request?.head?.sha;

Expand All @@ -132,8 +137,8 @@ async function postDiffComment(diffs: Diff[]): Promise<void> {

const prefixHeader = `## ArgoCD Diff on ${ENV}`
const diffOutput = diffs.map(
({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](https://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](${protocol}://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
YAML generation: ${error ? ' Error 🛑' : 'Success 🟢'}
App sync status: ${app.status.sync.status === 'Synced' ? 'Synced ✅' : 'Out of Sync ⚠️ '}
${
Expand Down
Loading