Skip to content

Update fetch.yml

Update fetch.yml #12

Workflow file for this run

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: |
# Fetch issues from the repository
if [ -n "$GITHUB_TOKEN" ]; then
API_DATA1=$(curl -H "Authorization: token ${{secrets.APP_ID}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/ARK-Builders/website/issues")
API_DATA2=$(curl -H "Authorization: token ${{secrets.APP_ID}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/ARK-Builders/arklib/issues")
API_DATA3=$(curl -H "Authorization: token ${{secrets.APP_ID}}" \
-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"> issues.json
else
curl -H "Accept: application/vnd.github.v3+json" "$GITHUB_API_URL" --output fiat-rates.json
fi
- name: Push into Git
run: |-
git config --global user.email "[email protected]"
git config --global user.name "ARK Builders Bot"
git add issues.json
git commit -m "Automated update of rates"
git push