Skip to content

Commit

Permalink
src/commands: report linting results base on repo name (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
datdao authored May 21, 2024
1 parent ca0d31f commit e086acf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_DB: test
POSTGRES_PASSWORD: pass
environment:
GITHUB_REPOSITORY: "ariga/atlas-orb"
steps:
- checkout
- atlas-orb/setup:
Expand All @@ -131,6 +133,8 @@ jobs:
integration-test-lint:
docker:
- image: cimg/base:current
environment:
GITHUB_REPOSITORY: "ariga/atlas-orb"
steps:
- checkout
- atlas-orb/setup:
Expand Down
15 changes: 7 additions & 8 deletions src/commands/migrate_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ parameters:
default: ''
description: |
The environment to use from the Atlas configuration file. For example, `dev`.
repo_url:
type: string
default: ''
github_repo_env:
type: env_var_name
default: GITHUB_REPOSITORY
description: |
The URL of the repository. If provided, linting results will be posted to the repository.
Otherwise, the repo url will based on your token type.
The repository name that linting results will be posted to.
github_token_env:
type: env_var_name
default: GITHUB_TOKEN
Expand All @@ -64,9 +63,9 @@ steps:
INPUT_VARS: <<parameters.vars>>
INPUT_DEV_URL: <<parameters.dev_url>>
command: |
# replace CIRCLE_REPOSITORY_URL with the repo_url if provided
if [ -n "<<parameters.repo_url>>" ]; then
CIRCLE_REPOSITORY_URL=<<parameters.repo_url>>
# replace GITHUB_REPOSITORY with the github_repo_env if provided
if [ -n "${<<parameters.github_repo_env>>}" ]; then
GITHUB_REPOSITORY=${<<parameters.github_repo_env>>}
fi
# replace GITHUB_TOKEN with the github_token_env if provided
if [ -n "${<<parameters.github_token_env>>}" ]; then
Expand Down
43 changes: 23 additions & 20 deletions src/examples/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ description: >
usage:
version: 2.1
orbs:
atlas-orb: ariga/[email protected]
atlas-orb: ariga/[email protected]
jobs:
push-dir:
docker:
- image: cimg/base:current
- image: cimg/postgres:16.2
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: pass
steps:
- checkout
- atlas-orb/setup:
version: "latest"
cloud_token_env: "ATLAS_TOKEN"
- atlas-orb/migrate_lint:
dir_name: my-cool-project
dev_url: "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable"
github_repo_env: "GITHUB_REPOSITORY"
github_token_env: "GITHUB_TOKEN"
- atlas-orb/migrate_push:
dir_name: my-cool-project
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable
workflows:
postgres-example:
jobs:
- push-dir:
context: the-context-has-ATLAS_TOKEN
docker:
- image: cimg/base:current
- image: cimg/postgres:16.2
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: pass
steps:
- checkout
- atlas-orb/setup:
version: "latest"
cloud_token_env: "ATLAS_TOKEN"
- atlas-orb/migrate_lint:
dir_name: my-cool-project
dev_url: "postgres://postgres:pass@localhost:5432/postgres?sslmode=disable"
github_token_env: "GITHUB_TOKEN"
- atlas-orb/migrate_push:
dir_name: my-cool-project
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable

0 comments on commit e086acf

Please sign in to comment.