Update fetch.yml #5
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: Fetch exchange rates | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
schedule: | |
- cron: "0 12 * * *" | |
env: | |
APP_ID: ${{ secrets.APP_ID }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch Issues | |
run: | | |
GITHUB_TOKEN=${{secrets.APP_ID}} | |
# Fetch issues from the repository | |
API_DATA1=$(curl -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/ARK-Builders/website/issues") | |
API_DATA2=$(curl -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/ARK-Builders/arklib/issues") | |
API_DATA3=$(curl -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/ARK-Builders/arklib-android/issues") | |
# Use JavaScript to parse the JSON arrays and combine them | |
# combined_json=$(node -e "const arr1 = ${API_DATA1}; const arr2 = ${API_DATA2}; const arr3 = ${API_DATA3}; const combined = [...arr1, ...arr2, ...arr3]; console.log(JSON.stringify(combined));") | |
# Set the output variable with the concatenated array | |
# echo "::set-output name=combined_json::${combined_json}" | |
echo "$API_DATA1" "$API_DATA2" "$API_DATA3"> test.json | |
- name: Push into Git | |
run: |- | |
git config --global user.email "[email protected]" | |
git config --global user.name "ARK Builders Bot" | |
git add test.json | |
git commit -m "Automated update of rates" | |
git push |