Update Saved Pools #224
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 Saved Pools | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run daily | |
workflow_dispatch: | |
permissions: write-all | |
jobs: | |
update_saved_pools: | |
name: Update Saved Pools | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
submodules: true | |
- name: Git Sumbodule Update | |
run: | | |
git submodule update --init --recursive | |
git submodule update --recursive --remote | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 19.6.0 | |
- name: Run code to Query Pools | |
working-directory: ./.github/workflows/utility | |
run: node queryPools.mjs | |
- name: Add Commit Push | |
uses: devops-infra/action-commit-push@master | |
with: | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
add_timestamp: false | |
commit_prefix: "[AUTO]" | |
commit_message: "Query and Save Pools" | |
force: false | |
target_branch: update/query_pools | |
- name: Create A PR | |
uses: devops-infra/action-pull-request@v0.4.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
source_branch: update/query_pools | |
target_branch: main | |
title: Query and Save Pools | |
body: "**Automated pull request**" | |
old_string: "**THIS IS AN AUTOMATED UPDATE OF ALL POOLS**" | |
new_string: "** Automatic pull request**" | |
get_diff: true | |
ignore_users: "dependabot" | |
id: create_pr | |
- name: Debug | |
run: | | |
echo "Create PR outputs: ${{ toJson(steps.create_pr.outputs) }}" | |
echo "github: ${{ toJson(github) }}" | |
- name: Merge Pull Request | |
if: steps.create_pr.outputs.url && github.job == 'update_saved_pools' | |
run: | | |
PR_URL=${{ steps.create_pr.outputs.url }} | |
PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}') | |
curl --location --request PUT "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/merge" \ | |
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
--header "Content-Type: application/json" \ | |
--data-raw '{ | |
"commit_title": "Automatically merged PR", | |
"commit_message": "This pull request was automatically merged.", | |
"merge_method": "squash" | |
}' |