Skip to content

Enable terminal

Enable terminal #36

Workflow file for this run

name: Auto-Lock Images
on:
pull_request:
types: [opened, synchronize]
branches: ["**"]
workflow_dispatch:
inputs:
branch:
description: "Branch to analyze and lock"
required: false
default: ""
permissions:
statuses: write
jobs:
lock:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Determine Branch
id: branch-name
run: |
# Use input branch if provided, otherwise fallback to ref_name
BRANCH="${{ github.event.inputs.branch }}"
if [ -z "$BRANCH" ]; then
BRANCH="${{ github.head_ref }}"
fi
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.branch-name.outputs.branch }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache apt packages
uses: actions/cache@v4
with:
path: |
/var/cache/apt/archives
/var/lib/apt/lists
key: ${{ runner.os }}-apt-skopeo-${{ hashFiles('.github/workflows/auto-lock.yaml') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Install Skopeo
run: |
if ! command -v skopeo &> /dev/null; then
sudo apt-get update
sudo apt-get install -y skopeo
else
echo "Skopeo is already installed: $(skopeo --version)"
fi
- name: Run Locker Script
run: python3 scripts/lock_builds.py
- name: Pull and Check for changes
id: git-check
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit and Push changes
if: steps.git-check.outputs.changed == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ steps.branch-name.outputs.branch }}
commit_message: "pin docker digests in build.yaml"
file_pattern: "**/build.yaml docker-lock.json"