Compare commits

...

14 Commits

Author SHA1 Message Date
alyx 7506090dd6 Update package name 2022-12-24 14:19:55 -06:00
alyx 988ba8ec1c Remove GITHUB_TOKEN support so as to avoid confusion from Gitea Actions roleplaying as Github 2022-12-24 14:15:37 -06:00
meli-release-bot 4107cb309d chore(release): 1.2.0 [skip ci]
# [1.2.0](https://github.com/getmeli/meli-cli/compare/v1.1.2...v1.2.0) (2021-02-18)

### Bug Fixes

* wrong logger namespace ([c616d2e](c616d2eb46))

### Features

* only warn repo undetected inside non-tty ([1b91ee6](1b91ee6c31))
* update axios ([091debe](091debe745))
2021-02-18 15:21:25 +00:00
Geoffroy Empain 1b91ee6c31 feat: only warn repo undetected inside non-tty 2021-02-18 16:16:58 +01:00
Geoffroy Empain c616d2eb46 fix: wrong logger namespace 2021-01-25 15:25:45 +01:00
Geoffroy Empain 0a12abda26 chore: set license in npm package 2021-01-25 15:24:47 +01:00
Geoffroy Empain 091debe745 feat: update axios 2021-01-25 15:24:06 +01:00
Geoffroy Empain d1da01e743 ci: run actions for pull requests 2020-12-28 23:27:02 +01:00
semantic-release 543f2ef0d3 chore: realign next on latest [ci skip] 2020-12-23 12:53:52 +00:00
semantic-release 71b346bcc4 chore: realign next on latest [ci skip] 2020-12-18 16:06:05 +00:00
semantic-release 8365015a2e chore: realign next on latest [ci skip] 2020-12-18 12:38:11 +00:00
Geoffroy Empain 0c3e85cbe1 ci: update release config 2020-12-16 12:11:22 +01:00
Geoffroy Empain 3ea2f6c0f8
chore: add PR template 2020-12-15 17:54:39 +01:00
Geoffroy Empain 9c1193dcf4 chore: update semantic-release-license 2020-12-14 18:23:20 +01:00
7 changed files with 45 additions and 47 deletions

11
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,11 @@
<!--
Thanks for opening a PR on this repo 🎉 ! This is just a quick reminder of things we'd like you to check before submitting:
- [ ] target your PR to branch `next`
- [ ] if necessary, updates the [docs](https://github.com/getmeli/meli-docs)
- [ ] use [semantic commits](https://www.conventionalcommits.org/en/v1.0.0)
- [ ] read our [contributing guidelines](https://github.com/getmeli/meli/blob/beta/CONTRIBUTING.md)
Thanks a lot, and happy coding 🚀
-->

View File

@ -1,8 +1,10 @@
name: main
on: [ push ]
on: [ push, pull_request ]
env:
GITHUB_REPOSITORY_SSH_URL: "git@github.com:${{ github.repository }}.git"
IS_RELEASE_BRANCH: "${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' }}"
GIT_AUTHOR_NAME: "meli-release-bot"
GIT_COMMITTER_NAME: "meli-release-bot"
jobs:
build:
runs-on: ubuntu-latest
@ -22,7 +24,7 @@ jobs:
echo "Next release version is $(cat VERSION)"
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Lint"
run: npm run lint
@ -43,7 +45,7 @@ jobs:
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "realign next"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}

View File

@ -1,3 +1,16 @@
# [1.2.0](https://github.com/getmeli/meli-cli/compare/v1.1.2...v1.2.0) (2021-02-18)
### Bug Fixes
* wrong logger namespace ([c616d2e](https://github.com/getmeli/meli-cli/commit/c616d2eb4661188b4d7926e7f96bb9937bdd5814))
### Features
* only warn repo undetected inside non-tty ([1b91ee6](https://github.com/getmeli/meli-cli/commit/1b91ee6c3176adf87c1dde6d875b42703e2a0d09))
* update axios ([091debe](https://github.com/getmeli/meli-cli/commit/091debe74562c0a2b869098a37d84d8c3220a563))
## [1.1.2](https://github.com/getmeli/meli-cli/compare/v1.1.1...v1.1.2) (2020-12-23)

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Meli
Copyright (c) 2021 Meli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

14
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@getmeli/cli",
"version": "1.1.0",
"version": "1.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -2206,9 +2206,9 @@
"dev": true
},
"axios": {
"version": "0.21.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
@ -5025,9 +5025,9 @@
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"follow-redirects": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
},
"for-in": {
"version": "1.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@getmeli/cli",
"version": "1.1.2",
"name": "@whatthegit/meli-cli",
"version": "1.2.0",
"description": "Meli CLI",
"main": "build/index.js",
"bin": {
@ -22,9 +22,9 @@
"lint:fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix"
},
"author": "Charlie Bravo SRL",
"license": "UNLICENSED",
"license": "MIT",
"dependencies": {
"axios": "^0.21.0",
"axios": "^0.21.1",
"chalk": "^4.1.0",
"debug": "^4.2.0",
"form-data": "^3.0.0",
@ -53,7 +53,7 @@
"eslint-plugin-security": "^1.4.0",
"jest": "^26.6.3",
"semantic-release": "^17.3.0",
"semantic-release-license": "^1.0.0",
"semantic-release-license": "^1.0.2",
"terser-webpack-plugin": "^2.3.8",
"ts-jest": "^25.5.1",
"ts-loader": "^6.2.2",

View File

@ -6,53 +6,25 @@ import { Gitlab } from './gitlab';
import { Gitea } from './gitea';
import { UploadResponse } from '../upload-response';
const logger = new Logger('meli.server:setCommitStatus');
const logger = new Logger('meli.cli:setCommitStatus');
export async function setCommitStatus(data: UploadResponse, release?: string): Promise<void> {
const commitHash = getCommitHash();
const repoId = getRepoId();
if (!repoId) {
logger.warn('Repo id not detected, cannot set commit status');
logger[process.stdout.isTTY ? 'debug' : 'warn']('Repo id not detected, cannot set commit status');
return;
}
if (!commitHash) {
logger.warn('Commit hash not detected, cannot set commit status');
logger[process.stdout.isTTY ? 'debug' : 'warn']('Commit hash not detected, cannot set commit status');
return;
}
const context = 'meli';
const description = release ? `Release ${release} deployed to Meli` : 'Site deployed to Meli';
if (process.env.GITHUB_TOKEN) {
logger.info('Setting Github commit status');
const github = new Github(process.env.GITHUB_TOKEN, process.env.GITHUB_SERVER_URL);
await github.setCommitStatus(repoId, commitHash, {
context,
description,
status: data ? 'success' : 'failure',
url: data?.urls[0],
});
} else {
logger.debug('Github token not found, will not set commit status');
}
if (process.env.GITLAB_TOKEN) {
logger.info('Setting Gitlab commit status');
const gitlab = new Gitlab(process.env.GITLAB_TOKEN, process.env.GITLAB_URL);
await gitlab.setCommitStatus(repoId, commitHash, {
name: context,
description,
state: data ? 'success' : 'failed',
url: data?.urls[0],
});
} else {
logger.debug('Gitlab token not found, will not set commit status');
}
if (process.env.GITEA_TOKEN && process.env.GITEA_URL) {
logger.info('Setting Gitea commit status');