Skip to content

Commit

Permalink
use workflow that takes multiple repo
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman committed Oct 22, 2024
1 parent 7872913 commit ab7f806
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/update-anchore-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ name: PR to update Anchore dependencies
on:
workflow_dispatch:
inputs:
from:
description: "Where to pull dependency commits from (branch or 'release')"
required: false
type: choice
options:
- "main" # reference commits from the main branch
- "auto/integration" # reference commits from a pre-release PR (like from this workflow)
- "release" # reference commits from the latest github release
default: "main"
repos:
description: "List of dependencies to update"
required: true
type: string

permissions:
contents: read
Expand All @@ -28,22 +23,11 @@ jobs:
tools: false
bootstrap-apt-packages: ""

- name: Update Stereoscope
id: stereoscope
uses: anchore/workflows/.github/actions/update-go-dependency@main
- name: Update dependencies
id: update
uses: anchore/workflows/.github/actions/update-go-dependency@add-dep-update
with:
repo: anchore/stereoscope
# note: even if you pass a branch or commit, go tooling will resolve this to a version tag if it exists
from: ${{ github.event.inputs.from }}

- name: Determine draft status
id: draft
run: |
if [ "${{ github.event.inputs.from }}" != "release" ]; then
echo "status=always-true" | tee -a $GITHUB_OUTPUT
else
echo "status=false" | tee -a $GITHUB_OUTPUT
fi
repos: ${{ github.event.inputs.repos }}

- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a #v2.1.0
id: generate-token
Expand All @@ -55,15 +39,11 @@ jobs:
with:
signoff: true
delete-branch: true
draft: ${{ steps.draft.outputs.status }}
draft: ${{ steps.update.outputs.draft }}
# do not change this branch, as other workflows depend on it
branch: auto/integration
labels: dependencies,pre-release
commit-message: "chore(deps): update anchore dependencies"
title: "chore(deps): update anchore dependencies"
body: |
***Using commits from***: ${{ github.event.inputs.from }}
## Dependencies changed
- Stereoscope: `${{ steps.stereoscope.outputs.original_version }}` ➔ `${{ steps.stereoscope.outputs.resolved_version }}` (**${{ steps.stereoscope.outputs.action }}** from `${{ steps.stereoscope.outputs.source }}`)
body: ${{ steps.update.outputs.changelog }}
token: ${{ steps.generate-token.outputs.token }}
12 changes: 12 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ vars:
ORAS: "{{ .TOOL_DIR }}/oras"
YQ: "{{ .TOOL_DIR }}/yq"
TASK: "{{ .TOOL_DIR }}/task"
GH: "{{ .TOOL_DIR }}/gh"

# used for changelog generation
CHANGELOG: CHANGELOG.md
Expand Down Expand Up @@ -132,6 +133,17 @@ tasks:
- "{{ .TMP_DIR }}"
cmd: "mkdir -p {{ .TMP_DIR }}"

## Dependency tasks #################################

update-anchore-dependencies:
desc: Update Anchore dependencies
deps: [tools]
requires:
vars:
- FROM
cmd: |
{{ .GH }} workflow run update-anchore-dependencies.yml -f repos="github.com/anchore/stereoscope@{{ .FROM }}"
## Static analysis tasks #################################

format:
Expand Down

0 comments on commit ab7f806

Please sign in to comment.