Skip to content

GitHub Actions Version Update #26

GitHub Actions Version Update

GitHub Actions Version Update #26

name: GitHub Actions Version Update
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
update-actions:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.DELTA_BOT_GH_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4.2.2
with:
token: ${{ secrets.DELTA_BOT_GH_TOKEN }}
- name: Update GitHub Actions
id: updater
uses: saadmk11/github-actions-version-updater@v0.8.1
with:
token: ${{ secrets.DELTA_BOT_GH_TOKEN }}
skip_pull_request: "true"
committer_username: "singulon"
committer_email: "deltaml@icloud.com"
continue-on-error: true
- name: Check for Changes
id: check_changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changes_detected=true" >> "$GITHUB_OUTPUT"
else
echo "changes_detected=false" >> "$GITHUB_OUTPUT"
fi
- name: Create Branch, Commit and Push
if: ${{ steps.check_changes.outputs.changes_detected == 'true' }}
id: commit_push
run: |
BRANCH_NAME="update-github-actions-$(date +%Y%m%d%H%M%S)"
git config --global user.name "singulon"
git config --global user.email "deltaml@icloud.com"
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "Apply changes from Update GitHub Actions"
git push "https://x-access-token:${{ secrets.DELTA_BOT_GH_TOKEN }}@github.com/${{ github.repository }}" "$BRANCH_NAME"
echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
- name: Create and Merge Pull Request
if: ${{ steps.check_changes.outputs.changes_detected == 'true' }}
run: |
DIFF=$(git diff HEAD~1 HEAD || true)
PR_BODY="Bump GitHub Actions versions
\`\`\`diff
$DIFF
\`\`\`"
PR_URL=$(gh pr create --base master --head "${{ steps.commit_push.outputs.branch_name }}" --title "Update GitHub Actions" --body "$PR_BODY" --draft=false --label "dependencies")
gh pr merge "$PR_URL" --squash --delete-branch --auto