-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
name: Fetch and Save JSON File | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
schedule: | ||
# Runs at the start of 5 minutes | ||
- cron: '*/5 * * * *' | ||
|
||
|
||
jobs: | ||
download-and-save-json: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: save json file into current directory | ||
run: | | ||
curl -o output_file.json -L "https://testing.zephyrproject.org/daily_tests/versions.json" | ||
- name: Check if JSON file exists and has changed | ||
id: check-file | ||
run: | | ||
if [[ -f bench_file.json ]]; then | ||
if cmp -s bench_file.json output_file.json; then | ||
echo "File exists and is unchanged." | ||
echo "::set-output name=changed::false" | ||
else | ||
echo "File exists and has changed." | ||
echo "::set-output name=changed::true" | ||
fi | ||
else | ||
echo "File does not exist." | ||
echo "::set-output name=changed::true" | ||
fi | ||
- name: Commit and push the new JSON file | ||
if: steps.check-file.outputs.changed == 'true' | ||
run: | | ||
mv -f output_file.json bench_file.json | ||
echo "start to commit changes ######===========" | ||
git config --local user.email "fabrice.djiatsa-ext@st.com" | ||
git config --local user.name "fab-djiatsa" | ||
git add . | ||
git commit -m "updated zephyr JSON file" -a | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_RED }}" push origin main | ||