Organize #255
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: Organize | |
on: | |
schedule: | |
- cron: 0 12 * * * | |
workflow_dispatch: | |
jobs: | |
organize: | |
runs-on: ubuntu-latest | |
continue-on-error: true # Because step 3 will errors out if there is no new commits | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
with: | |
path: self | |
- name: Checkout Lucaslhm/Flipper-IRDB | |
uses: actions/checkout@v4 | |
with: | |
path: Flipper-IRDB | |
repository: Lucaslhm/Flipper-IRDB | |
- name: Check if the repo updated | |
run: | | |
set +e | |
cd Flipper-IRDB | |
git log -1 --pretty=%H > ../irdb_commit.sha | |
cmp -s ../irdb_commit.sha ../self/.irdb_commit.sha | |
echo "NEW_COMMIT_PUSHED=$?" >> $GITHUB_ENV | |
- name: Exits if repo is up-to-date | |
if: ${{ env.NEW_COMMIT_PUSHED != '1' }} | |
run: | | |
echo $NEW_COMMIT_PUSHED | |
exit 1 | |
- name: Setup Python | |
uses: actions/[email protected] | |
- name: Run script | |
run: python3 self/.github/workflows/main.py ./Flipper-IRDB ./self | |
- name: Update HEAD index | |
run: | | |
cd Flipper-IRDB | |
git log -1 --pretty=%H > ../self/.irdb_commit.sha | |
- name: Commit changes | |
run: | | |
cd self | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Auto update: $(date "+%D %H:%M")" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
directory: ./self | |
- name: Add the artifact | |
uses: actions/[email protected] | |
with: | |
path: ./self |