Skip to content

Scheduled Update Versions #7

Scheduled Update Versions

Scheduled Update Versions #7

Workflow file for this run

---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2024
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
name: Scheduled Update Versions
# yamllint disable-line rule:truthy
on:
schedule:
- cron: '0 0 * * 5'
workflow_dispatch:
jobs:
check-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # refs/tags/v4.1.7
- uses: technote-space/create-pr-action@91114507cf92349bec0a9a501c2edf1635427bc5 # refs/tags/v2.1.4
with:
EXECUTE_COMMANDS: |
gh_actions=$(grep -r "uses: [a-z\-]*/[\_a-z\-]*@" .github/workflows/ | sed 's/@.*//' | awk -F ': ' '{ print $3 }' | sort | uniq)
for action in $gh_actions; do
commit_hash=$(git ls-remote --tags "https://github.com/$action" | grep 'refs/tags/v[0-9][0-9\.]*$' | awk '{ print $NF,$0 }' | sort -k1,1 -V | cut -f2- -d' ' | grep -oh '.*refs/tags/[v0-9\.]*$' | tail -1 | awk '{ printf "%s # %s\n",$1,$2 }')
grep -ElRZ "uses: $action@" .github/workflows/ | xargs -0 -l sed -i -e "s|uses: $action@.*|uses: $action@$commit_hash|g"
done
COMMIT_MESSAGE: 'Upgrade versions GitHub actions'
COMMIT_NAME: 'updater bot'
PR_BRANCH_NAME: "versions-update-${PR_ID}"
PR_TITLE: 'chore: update gh versions'