Skip to content

Commit

Permalink
Merge pull request #132 from Homebrew/ww/fix-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw authored Nov 19, 2024
2 parents be53488 + 33565c9 commit 55de727
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
permissions:
# NOTE: Needed to push to the repository.
contents: write
outputs:
auto-pr-ref: ${{ steps.commit.outputs.auto-pr-ref }}
steps:
- name: Check out this repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
Expand Down Expand Up @@ -46,15 +48,22 @@ jobs:
- run: python3 pip-audit-bulk

- name: Commit and push if it changed
id: commit
run: |-
git config user.name "github.actions"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "Latest data: ${timestamp}" || exit 0
echo "auto-pr-ref=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
git push
auto-pr:
needs: [audit]
uses: ./.github/workflows/auto-pr.yml
secrets: inherit
with:
# NOTE: Without this, the reusable workflow will checkout
# the GITHUB_REF from the caller workflow, i.e. the commit
# right before our push above.
ref: ${{ needs.audit.outputs.auto-pr-ref }}
9 changes: 9 additions & 0 deletions .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
required: true
default: true
type: boolean
ref:
required: false
default: ''
type: string
workflow_call:
inputs:
pr-limit:
Expand All @@ -19,6 +23,9 @@ on:
dry-run:
default: false # don't dry-run by default when called from another workflow
type: boolean
ref:
default: ${{ github.ref }}
type: string

jobs:
auto-pr:
Expand All @@ -39,6 +46,8 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
# will expand to '' when unset in workflow_dispatch, i.e. default branch
ref: ${{ inputs.ref }}

- name: Set up Homebrew
id: set-up-homebrew
Expand Down

0 comments on commit 55de727

Please sign in to comment.