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

src/commands: report linting results base on repo name #15

Merged
merged 3 commits into from
May 21, 2024
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
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