add generated changelog #9
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
name: Update changelog for DBT marts | |
on: | |
push: | |
branches: | |
- patch/add-data-changelog | |
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 | |
env: | |
IS_RECENCY_AIRFLOW_TASK: "false" | |
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 "[email protected]" | |
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 | |
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 --no-verify -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: Use that secret output (protected by a mask) | |
run: | | |
echo "the secret number is ${{ steps.commit_changes.outputs.changes_committed }}" | |
- 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 'Merge ${{ steps.create_branch.outputs.branch }} into master' \ | |
--body 'Created by GitHub action' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |