Skip to content

Refresh Channels

Refresh Channels #60

name: Refresh Channels
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
refresh-channels:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: 'main'
fetch-depth: 0
- name: Run refresh script
run: ./refresh_channels.sh
- name: Open a new PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "do-not-use@elemental.suse.com"
git config --global user.name "GitHub Action Runner"
branch_name="gha-refresh-${{ github.run_id }}-${{ github.run_number}}-${{ github.run_attempt }}"
git switch --force-create "${branch_name}" origin/main
git add .
if git diff-index --quiet HEAD; then
echo "No new updates. Nothing to do."
exit 0
fi
git commit -m "Automatic update. Run ID ${{ github.run_id }}, Number ${{ github.run_number}}, Attempt ${{ github.run_attempt }}"
git push --force origin "${branch_name}"
gh pr create --fill --head "${branch_name}"