Update packages list #41
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: Update packages list | |
on: | |
schedule: | |
- cron: '0 0 1 1-12/1 *' # Run every month | |
workflow_dispatch: {} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: Update packages list in README | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '27.0' | |
elixir-version: '1.17.2' | |
- name: Update packages list | |
env: | |
GH_TOKEN: ${{ secrets.BOT_TOKEN }} | |
run: | | |
echo "Run script" | |
elixir scripts/elixir/update_packages_list.exs > output.txt 2> output.txt || ERROR=$? || true | |
cat output.txt | |
echo "Set status" | |
STATUS=$(if [ -n "$ERROR" ]; then echo "[Failed]"; else echo "[Passed]"; fi) | |
echo "Status: ${STATUS}" | |
echo "Configure git" | |
git config user.name 'Membrane Bot' | |
git config user.email '[email protected]' | |
echo "Checkout" | |
git checkout -B auto-update-packages-list | |
echo "Commit" | |
git add README.md | |
git commit -m "auto update packages list in readme" --allow-empty | |
echo "Push" | |
git push -f -u origin auto-update-packages-list | |
echo "Create PR" | |
gh pr create -B master -H auto-update-packages-list --label no-changelog --title "${STATUS} Auto update packages list" --body-file output.txt \ | |
|| gh pr edit auto-update-packages-list --title "${STATUS} Auto update packages list" --body-file output.txt |