diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..e98d243 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,76 @@ +name: Update + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +env: + GITHUB_TOKEN: ${{ secrets._GITHUB_API_KEY }} + REPO_DIR: ${{ github.event.repository.name }} + +jobs: + Update: + runs-on: ubuntu-latest + + steps: + - name: Clone + run: git clone -b main https://x-access-token:${{ secrets._GITHUB_API_KEY }}@github.com/codycbakerphd/$REPO_DIR.git + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.13 + + - name: Run update + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + pip install historia + + historia github update --directory ./derivatives --recency 2 --username codycbakerphd --request graphql + historia github update --directory ./derivatives --recency 2 --username asmacdo --request graphql + historia github update --directory ./derivatives --recency 2 --username candleindark --request graphql + historia github update --directory ./derivatives --recency 2 --username vmdocua --request graphql + historia github update --directory ./derivatives --recency 2 --username yarikoptic --request graphql + + - name: Upload content + run: | + git -C $REPO_DIR add . + git -C $REPO_DIR commit --message "update" || true # || true in case of no changes + git -C $REPO_DIR push + + - name: Run minification + run: | + cd work-history-data + + historia minify --directory ./derivatives/version-0+1/username-codycbakerphd/request-graphql + + historia github populate --directory . --project-url https://github.com/users/CodyCBakerPhD/projects/4 + historia github populate --directory . --project-url https://github.com/orgs/con/projects/6 --status Incoming + + - name: Upload minification + run: | + git -C $REPO_DIR push origin --delete min || true # || true in case branch doesn't exist yet + + git -C $REPO_DIR checkout -b min + git -C $REPO_DIR add . + git -C $REPO_DIR commit --message "update min" || true # || true in case of no changes + git -C $REPO_DIR push --set-upstream origin min + + NotifyOnFailure: + runs-on: ubuntu-latest + needs: [ Update ] + if: ${{ always() && failure() }} + steps: + - uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.MAIL_USERNAME }} + password: ${{ secrets.MAIL_PASSWORD }} + subject: "CI Failure: Work history data" + to: cody.c.baker.phd@gmail.com # Add more with comma separation (no spaces) + from: work-history + body: "Please check the latest run of my work history update: https://github.com/codycbakerphd/work-history-data/actions/workflows/update.yml"