-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lucie Milan
committed
Oct 13, 2023
1 parent
efa626f
commit 0404779
Showing
2 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Get JSON schemas from catalog JSON file | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tap: | ||
type: string | ||
description: 'Name of the tap' | ||
required: true | ||
version: | ||
type: number | ||
description: 'Tap major version' | ||
required: true | ||
branch: | ||
type: string | ||
description: 'Name of your branch on the docs repository' | ||
required: true | ||
file: | ||
type: string | ||
description: 'Name of the JSON file added to the scripts/json folder' | ||
required: true | ||
pr: | ||
type: boolean | ||
description: 'Create pull request?' | ||
required: true | ||
|
||
jobs: | ||
generate-changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get current date | ||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
|
||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Checkout branch | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git fetch | ||
git checkout ${{ github.event.inputs.branch }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install Python modules | ||
uses: BSFishy/pip-action@v1 | ||
with: | ||
packages: | | ||
requests | ||
- name: Get JSON files | ||
run: python manual_json_import.py ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.tap }} ${{ github.event.inputs.version }} ${{ github.event.inputs.file }} | ||
working-directory: ./scripts/json | ||
|
||
- name: Check for changes | ||
id: get_changes | ||
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" | ||
|
||
- name: Commit changes | ||
if: steps.get_changes.outputs.changed != 0 | ||
run: | | ||
git add -A | ||
git config --global user.email "[email protected]" | ||
git config --global user.name 'github-actions' | ||
git commit -am "Automated commit: Generate JSON schemas" | ||
- name: Push changes | ||
if: steps.get_changes.outputs.changed != 0 | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.event.inputs.branch }} | ||
|
||
- name: Create pull request | ||
if: steps.get_changes.outputs.changed != 0 && ${{ github.event.inputs.pr }} == true | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
source_branch: ${{ github.event.inputs.branch }} | ||
destination_branch: "master" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_label: "json-schemas-update" | ||
pr_title: ${{ github.event.inputs.tap }} JSON schema updates ${{ env.date }} | ||
pr_draft: true | ||
pr_assignee: ${{ github.actor }} | ||
pr_reviewer: "lmilan" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Import JSON schemas | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repo: | ||
type: string | ||
description: 'Name of the Singer repository' | ||
required: true | ||
branch: | ||
type: string | ||
description: 'Name of the Singer repository branch' | ||
required: false | ||
|
||
jobs: | ||
generate-changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get current date | ||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
|
||
- name: Generate new branch name | ||
run: echo "branch=schemas-${{ github.event.inputs.repo }}-${{ github.actor }}-${{ env.date }}" >> $GITHUB_ENV | ||
|
||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create new branch | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git fetch | ||
# git checkout master | ||
git checkout TDL-23186-json-schema | ||
git branch ${{ env.branch }} | ||
|
||
- name: Checkout branch | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git fetch | ||
git checkout ${{ env.branch }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install Python modules | ||
uses: BSFishy/pip-action@v1 | ||
with: | ||
packages: | | ||
requests | ||
- name: Get JSON files | ||
run: python get_json_files.py ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.repo }} ${{ github.event.inputs.branch }} | ||
working-directory: ./scripts/json | ||
|
||
- name: Check for changes | ||
id: get_changes | ||
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" | ||
|
||
- name: Commit changes | ||
if: steps.get_changes.outputs.changed != 0 | ||
run: | | ||
git add -A | ||
git config --global user.email "[email protected]" | ||
git config --global user.name 'github-actions' | ||
git commit -am "Automated commit: Add JSON schemas" | ||
- name: Push changes | ||
if: steps.get_changes.outputs.changed != 0 | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ env.branch }} | ||
|
||
- name: Create pull request | ||
if: steps.get_changes.outputs.changed != 0 | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
source_branch: ${{ env.branch }} | ||
destination_branch: "master" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_label: "json-schemas-update" | ||
pr_title: ${{ github.event.inputs.repo }} JSON schema updates ${{ env.date }} | ||
pr_draft: true | ||
pr_assignee: ${{ github.actor }} | ||
pr_reviewer: "lmilan" |