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

chore: update ozbargain referrals list #219

Closed
Closed
41 changes: 33 additions & 8 deletions .github/workflows/build-ozbargain-referrals-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,56 @@ name: Build OzBargain referrals list

on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
# schedule:
# - cron: '0 0 1 * *'
push:
branches:
- test-referrals-automate

jobs:
build-referrals-list:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up project
uses: ./.github/actions/setup-node-deps

- name: Build OzBargain referrals list
run: pnpm run build:referrals
env:
AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
AXIOM_DATASET: ${{ secrets.AXIOM_DATASET }}
AXIOM_ORG_ID: ${{ secrets.AXIOM_ORG_ID }}
CLIENT_ID: blank
TOKEN: blank
DATABASE_URL: blank

- name: print out file
run: |
ls src/commands/referral/generated
cat src/commands/referral/generated/ozbargain-services.json

- name: Setup Git Credentials
run: |
git config --global user.email "[email protected]"
git config --global user.name "Vietausit Admin (Github Actions)"
git status --porcelain

- name: Compare changes
run: |
git diff --quiet && git diff --staged --quiet || git commit -am 'Added license headers'

- name: Create new PR
- name: Compare changes and create PR if succeed
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create --title "chore: update OzBargain referrals list" --body "This PR updates the OzBargain referrals list" --base master
if [[ `git status --porcelain` ]]; then
git checkout -b automated-referrals-update
git add src/commands/referral
git commit -m "chore: update ozbargain referrals list"
git push -f -u origin automated-referrals-update
gh pr create --title "chore: update ozbargain referrals list" --body "this is generated via build-ozbargain-referrals-list.yml" --base master --head automated-referrals-update
else
echo "No changes to report"
fi
Loading