Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aweis89 committed Dec 1, 2023
1 parent 35ebd26 commit 2aea585
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
1 change: 1 addition & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test('test runs', () => {
process.env['INPUT_ARGOCD-VERSION'] = 'v1.6.1';
process.env['INPUT_ARGOCD-SERVER-URL'] = 'argocd.qzlt.io';
process.env['INPUT_ARGOCD-TOKEN'] = 'foo';
process.env['INPUT_TOKEN'] = 'foo';
const ip = path.join(__dirname, '..', 'lib', 'main.js');
const options: cp.ExecSyncOptions = {
env: process.env
Expand Down
9 changes: 2 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@ const ARGOCD_SERVER_URL = core.getInput('argocd-server-url');
const ARGOCD_TOKEN = core.getInput('argocd-token');
const VERSION = core.getInput('argocd-version');
const ENV = core.getInput('environment');
const PLAINTEXT = core.getInput('plaintext').toLowerCase() == "true";
const PLAINTEXT = core.getInput('plaintext').toLowerCase() === "true";
let EXTRA_CLI_ARGS = core.getInput('argocd-extra-cli-args');
if (PLAINTEXT) {
EXTRA_CLI_ARGS += ' --plaintext';
Expand Down Expand Up @@ -1763,7 +1763,7 @@ function getApps() {
core.error(e);
}
return responseJson.items.filter(app => {
let targetPrimary = app.spec.source.targetRevision === 'master' || app.spec.source.targetRevision === 'main';
const targetPrimary = app.spec.source.targetRevision === 'master' || app.spec.source.targetRevision === 'main';
return (app.spec.source.repoURL.includes(`${github.context.repo.owner}/${github.context.repo.repo}`) && targetPrimary);
});
});
Expand Down Expand Up @@ -1817,11 +1817,6 @@ _Updated at ${new Date().toLocaleString('en-US', { timeZone: 'America/Los_Angele
| ⚠️ | The app is out-of-sync in ArgoCD, and the diffs you see include those changes plus any from this PR. |
| 🛑 | There was an error generating the ArgoCD diffs due to changes in this PR. |
`);
const commentsResponse = yield octokit.rest.issues.listComments({
issue_number: github.context.issue.number,
owner,
repo
});
// Only post a new comment when there are changes
if (diffs.length) {
octokit.rest.issues.createComment({
Expand Down
10 changes: 2 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ARGOCD_SERVER_URL = core.getInput('argocd-server-url');
const ARGOCD_TOKEN = core.getInput('argocd-token');
const VERSION = core.getInput('argocd-version');
const ENV = core.getInput('environment');
const PLAINTEXT = core.getInput('plaintext').toLowerCase() == "true";
const PLAINTEXT = core.getInput('plaintext').toLowerCase() === "true";
let EXTRA_CLI_ARGS = core.getInput('argocd-extra-cli-args');
if (PLAINTEXT) {
EXTRA_CLI_ARGS += ' --plaintext';
Expand Down Expand Up @@ -108,7 +108,7 @@ async function getApps(): Promise<App[]> {
}

return (responseJson.items as App[]).filter(app => {
let targetPrimary = app.spec.source.targetRevision === 'master' || app.spec.source.targetRevision === 'main'
const targetPrimary = app.spec.source.targetRevision === 'master' || app.spec.source.targetRevision === 'main'
return (
app.spec.source.repoURL.includes(
`${github.context.repo.owner}/${github.context.repo.repo}`
Expand Down Expand Up @@ -179,12 +179,6 @@ _Updated at ${new Date().toLocaleString('en-US', { timeZone: 'America/Los_Angele
| 🛑 | There was an error generating the ArgoCD diffs due to changes in this PR. |
`);

const commentsResponse = await octokit.rest.issues.listComments({
issue_number: github.context.issue.number,
owner,
repo
});

// Only post a new comment when there are changes
if (diffs.length) {
octokit.rest.issues.createComment({
Expand Down

0 comments on commit 2aea585

Please sign in to comment.