Skip to content

Sync workflows

Sync workflows #211

on:
schedule:
- cron: 0 11 * * 4
repository_dispatch:
types: [sync-workflows]
workflow_dispatch:
name: Sync workflows
jobs:
release:
name: Sync workflows
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set variables
run: |
echo "MINUTE=$(echo "${GITHUB_REPOSITORY}" | md5sum | tr -d -c 0-9 | xargs -I{} echo {}123456789 | cut -c 2-9 | xargs -I{} bash -c 'echo $((1{} % 60))')" >> $GITHUB_ENV
echo "HOUR=$(echo "${GITHUB_REPOSITORY}" | md5sum | tr -d -c 0-9 | xargs -I{} echo {}123456789 | cut -c 2-9 | xargs -I{} bash -c 'echo $((1{} % 24))')" >> $GITHUB_ENV
echo "DAY=$(echo "${GITHUB_REPOSITORY}" | md5sum | tr -d -c 0-9 | xargs -I{} echo {}123456789 | cut -c 2-9 | xargs -I{} bash -c 'echo $((1{} % 7))')" >> $GITHUB_ENV
- name: Sync workflows
uses: technote-space/create-pr-action@v2
with:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
EXECUTE_COMMANDS: |
rm -rdf .github/workflows/.tmp
mkdir -p .github/workflows/.tmp
git clone --depth=1 https://github.com/technote-space/github-actions-workflows.git .github/workflows/.tmp/workflows
bash .github/workflows/.tmp/workflows/gh-actions/copy.sh
sed -i "s/cron:.\+$/cron: ${MINUTE} ${HOUR} * * ${DAY}/" .github/workflows/update-dependencies.yml
rm -rdf .github/workflows/.tmp
COMMIT_MESSAGE: 'chore: sync workflows'
PR_BRANCH_PREFIX: chore/
PR_BRANCH_NAME: 'chore-sync-workflows'
PR_TITLE: 'chore: sync workflows'
ONLY_DEFAULT_BRANCH: true