mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-28 16:50:19 +00:00
Merge pull request #956 from hakman/remove-update-deps
chore: Remove broken workflow update-deps.yml
This commit is contained in:
105
.github/workflows/update-deps.yml
vendored
105
.github/workflows/update-deps.yml
vendored
@@ -1,105 +0,0 @@
|
||||
name: 'Update Dependencies'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 20 * * 4'
|
||||
|
||||
env:
|
||||
GOPROXY: https://proxy.golang.org
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
update-deps:
|
||||
if: ${{ github.repository == 'kubernetes/node-problem-detector' }}
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
||||
with:
|
||||
go-version: '1.22.3'
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||
- name: Update Dependencies
|
||||
id: update_deps
|
||||
run: |
|
||||
make depup
|
||||
echo 'changes<<EOF' >> $GITHUB_OUTPUT
|
||||
git status --porcelain >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
- name: Create PR
|
||||
if: ${{ steps.update_deps.outputs.changes != '' }}
|
||||
uses: peter-evans/create-pull-request@2f38cd26bfebe301a5ee90bdd6550a69dc3ef23f # v7.0.4
|
||||
with:
|
||||
title: 'Update dependencies'
|
||||
commit-message: Update dependencies
|
||||
committer: github-actions <actions@github.com>
|
||||
author: github-actions <actions@github.com>
|
||||
branch: dependencies/update
|
||||
branch-suffix: timestamp
|
||||
base: master
|
||||
delete-branch: true
|
||||
labels: ok-to-test
|
||||
body: |
|
||||
Updating go.mod with latest dependencies...
|
||||
update-go-version:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Get current Go version from Dockerfile
|
||||
id: current-go-version
|
||||
run: |
|
||||
# Read the Dockerfile content
|
||||
DOCKERFILE_CONTENT=$(cat Dockerfile)
|
||||
|
||||
# Extract the current Go version using regex
|
||||
CURRENT_GO_VERSION=$(echo "$DOCKERFILE_CONTENT" | grep -oP 'FROM golang:\K\d+\.\d+(\.\d+)?')
|
||||
echo "current_go_version=${CURRENT_GO_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get latest Go version
|
||||
id: go-version
|
||||
run: |
|
||||
# Fetch the Go download page and extract the latest version
|
||||
LATEST_GO_VERSION=$(curl -s https://go.dev/dl/ | grep -oP 'go1\.22\.\d+' | sort -rV | head -n 1)
|
||||
echo "latest_go_version=${LATEST_GO_VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update Go version
|
||||
uses: jacobtomlinson/gha-find-replace@v3
|
||||
with:
|
||||
find: "FROM golang:${{ steps.current-go-version.outputs.current_go_version }}-bookworm as builder-base"
|
||||
replace: "FROM golang:${{ steps.go-version.outputs.latest_go_version }}-bookworm as builder-base"
|
||||
path: "Dockerfile"
|
||||
|
||||
- name: Check if Go version was updated
|
||||
id: check-changes
|
||||
run: |
|
||||
if [[ ${{ steps.current-go-version.outputs.current_go_version }} != ${{ steps.go-version.outputs.latest_go_version }} ]]; then
|
||||
echo "changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create Pull Request
|
||||
if: ${{ steps.check-changes.outputs.changes == 'true' }} # Only create PR if there were changes
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
title: 'Update Go version in Dockerfile'
|
||||
commit-message: 'Update Go version in Dockerfile'
|
||||
committer: github-actions <actions@github.com>
|
||||
author: github-actions <actions@github.com>
|
||||
branch: go-version-update # Choose a suitable branch name
|
||||
branch-suffix: timestamp
|
||||
base: master
|
||||
delete-branch: true
|
||||
labels: ok-to-test
|
||||
body: |
|
||||
This PR updates the Go version in the Dockerfile to ${{ steps.go-version.outputs.latest_go_version }}.
|
||||
|
||||
Reference in New Issue
Block a user