-
Notifications
You must be signed in to change notification settings - Fork 18
72 lines (62 loc) · 2.66 KB
/
update_dbt_marts_schema_changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Update changelog for DBT marts
on:
schedule:
- cron: "0 23 * * 1-5" # This will run at 11 PM UTC, which is 5 PM CST
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}-{{ github.event_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Authenticate to crypto-stellar GCP
uses: "google-github-actions/auth@v2"
with:
project_id: hubble-261722
credentials_json: "${{ secrets.CREDS_PROD_HUBBLE }}"
- name: Set up Google Cloud SDK
run: |
echo "Installing Google Cloud SDK..."
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
- name: Create new branch
id: create_branch
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
BRANCH_NAME="update-data-schema-changelog-${{ github.run_id }}"
git checkout -b $BRANCH_NAME
echo "::set-output name=branch::$BRANCH_NAME"
- name: Run Bash Script
run: |
cd $GITHUB_WORKSPACE
PROJECT=hubble-261722
export PROJECT
output=$(. scripts/update_dbt_marts_schema_changelog.sh)
echo "$output" > changelog/dbt_marts.md
- name: Commit changes
id: commit_changes
run: |
git add changelog/dbt_marts.md
if git commit -m "Update changelog for DBT marts"; then
echo "Changes committed."
echo "changes_committed=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "changes_committed=false" >> $GITHUB_OUTPUT
fi
- name: Push branch
if: steps.commit_changes.outputs.changes_committed == 'true'
run: |
git push origin ${{ steps.create_branch.outputs.branch }}
- name: Create Pull Request
if: steps.commit_changes.outputs.changes_committed == 'true'
run: |
gh pr create -B master -H ${{ steps.create_branch.outputs.branch }} \
--title 'Update schema changelog for DBT marts' \
--body 'This is an autogenerated PR to update schema changelog for marts.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}