Skip to content

custom-upgrade-awscli-v2-main #596

custom-upgrade-awscli-v2-main

custom-upgrade-awscli-v2-main #596

name: custom-upgrade-awscli-v2-main
on:
workflow_dispatch: {}
schedule:
# run the upgrade weekly
- cron: 0 0 * * 5
jobs:
upgrade:
name: Upgrade
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
patch_created: ${{ steps.create_patch.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: awscli-v2/main
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Check for awscli version upgrades
working-directory: ./.github/scripts
run: ls -ahls ../../layer
- name: Check for awscli version upgrades
working-directory: ./.github/scripts
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python3 -c "import subprocess; subprocess.check_call(('pwd'))"
python3 -c "import subprocess; subprocess.check_call(('sed', '-i', '', '-e', \"/amazon\\\\/aws-cli:/s/:.*/:%s/\"%('123'), '../../layer/Dockerfile'), stdout=subprocess.PIPE)"
cat ../../layer/Dockerfile
python3 -c "import subprocess; subprocess.check_call(('sed', '-i', '', '-e', \"/amazon\\\\/aws-cli:/s/:.*/:%s/\"%('123'), '../../layer/Dockerfile'))"
cat ../../layer/Dockerfile
python3 upgrade-awscli-version.py
- id: create_patch
name: Find mutations
run: |-
git add .
git diff --staged --patch --exit-code > repo.patch || echo "name=patch_created" >> $GITHUB_OUTPUT
- if: steps.create_patch.outputs.patch_created
name: Upload patch
uses: actions/[email protected]
with:
name: repo.patch
path: repo.patch
pr:
name: Create Pull Request
needs: upgrade
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: ${{ needs.upgrade.outputs.patch_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
ref: awscli-v2/main
- name: Download patch
uses: actions/download-artifact@v4
with:
name: repo.patch
path: ${{ runner.temp }}
- name: Apply patch
run: '[ -s ${{ runner.temp }}/repo.patch ] && git apply ${{ runner.temp }}/repo.patch || echo "Empty patch. Skipping."'
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
commit-message: |-
fix(deps): upgrade AWS CLI dependency
Upgrades AWS CLI dependency. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
base: awscli-v2/main
branch: github-actions/upgrade-awscli-v2-main
title: "fix(deps): upgrade AWS CLI dependency"
labels: auto-approve
body: |-
Upgrades AWS CLI dependency. See details in [workflow run].
[Workflow Run]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
author: github-actions <[email protected]>
committer: github-actions <[email protected]>
signoff: true