Skip to content

♻️ Update shared DevOps tooling #1

♻️ Update shared DevOps tooling

♻️ Update shared DevOps tooling #1

Workflow file for this run

---
name: "♻️ Update shared DevOps tooling"
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
schedule:
- cron: "0 8 * * MON"
jobs:
update-actions:
name: "Update DevOps tooling"
runs-on: ubuntu-latest
permissions:
# IMPORTANT: mandatory to update content/actions/PRs
contents: write
actions: write
pull-requests: write
steps:
- name: "Checkout primary repository"
uses: actions/checkout@v4
with:
# Note: Requires a specific/defined Personal Access Token
token: ${{ secrets.ACTIONS_WORKFLOW }}
- name: "Pull workflows from central repository"
uses: actions/checkout@v4
with:
repository: "os-climate/devops-toolkit"
path: ".devops"
- name: "Update repository workflows and create PR"
env:
GH_TOKEN: ${{ github.token }}
run: |
# Remove update-devops-tooling branch if it exists
git branch -d update-devops-tooling || true
git push origin --delete update-devops-tooling || true
git config user.name "github-actions[bot]"
git config user.email \
"41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "update-devops-tooling"
FOLDERS=".github .github/workflows scripts"
FILES=".pre-commit-config.yaml .prettierignore .gitignore"
for FOLDER in ${FOLDERS}; do
# If necessary, create target folder
if [ ! -d "$FOLDER" ]; then
mkdir "$FOLDER"
fi
# Update folder contents
cp -a .devops/"$FOLDER"/. "$FOLDER"
done
# Copy specified files into repository root
for FILE in ${FILES}; do
cp .devops/"$FILE" "$FILE"
done
git add .
git commit -m "Chore: Update DevOps tooling from central repository"
git push --set-upstream origin update-devops-tooling
gh pr create --title \
"Chore: Pull DevOps tooling from upstream repository" \
--body 'This process automated by a GitHub workflow: bootstrap.yaml'