Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 32 additions & 19 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
name: Update repository files
runs-on: ubuntu-slim
permissions:
contents: write # Required to commit synced template and workflow updates.
pull-requests: write # Required to open the generated update pull request.
issues: write # Required for generated update pull request metadata.
contents: write # Required to commit synced template and workflow updates.
pull-requests: write # Required to open the generated update pull request.
issues: write # Required for generated update pull request metadata.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -51,27 +51,40 @@ jobs:
- name: Create fork
# no-op if the repository is already forked
run: |
FORK="$(gh repo fork --clone=false --default-branch-only 2>&1 | awk '{print $1}' | sed 's|^https://github.com/||')"
FORK="$(gh api repos/:owner/:repo/forks --method POST -f default_branch_only=true --jq .full_name)"
echo "FORK=${FORK}" >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.SYNC_TOKEN }}
GH_TOKEN: ${{ secrets.SYNC_TOKEN }} # zizmor: ignore[secrets-outside-env] Cross-repo sync token; environment policy unchanged.

- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
push-to-fork: ${{ env.FORK }}
token: ${{ secrets.SYNC_TOKEN }}
branch: update
delete-branch: true
title: πŸ€– Update infrastructure file(s)
body: |
[update.yml]: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/update.yml
- name: Compose pull request body
# written to disk (instead of `body:`) to avoid E2BIG ("Argument list
# too long") when large summaries are passed as action inputs
run: |
cat >> "$RUNNER_TEMP/pr-body.md" <<EOF
[update.yml]: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/blob/main/.github/workflows/update.yml

Your friendly repository updater.
Your friendly repository updater.

${{ steps.durations.outputs.summary }}
$DURATIONS_SUMMARY

${{ steps.templates.outputs.summary }}
$TEMPLATES_SUMMARY

This PR was triggered by @${{ github.triggering_actor }} via ${{ github.event_name }}.
This PR was triggered by @$GITHUB_TRIGGERING_ACTOR via $GITHUB_EVENT_NAME.

###### Auto-generated by the [`update.yml`][update.yml] workflow, see ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
###### Auto-generated by the [\`update.yml\`][update.yml] workflow, see $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID.
EOF
env:
DURATIONS_SUMMARY: ${{ steps.durations.outputs.summary }}
TEMPLATES_SUMMARY: ${{ steps.templates.outputs.summary }}
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}

- name: Create update PR
# zizmor: ignore[superfluous-actions] Handles fork push and PR creation.
uses: peter-evans/create-pull-request@3ffccacd46053766916f087ce41d627c0b8cf2d1 # v8.1.3
with:
push-to-fork: ${{ env.FORK }}
token: ${{ secrets.SYNC_TOKEN }} # zizmor: ignore[secrets-outside-env] Cross-repo sync token; environment policy unchanged.
branch: update
delete-branch: true
title: πŸ€– Update infrastructure file(s)
body-path: ${{ runner.temp }}/pr-body.md
Loading