Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .github/workflows/.ncmake-workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"source": "nextcloud"
},
"branch-cleanup.yml": {
"hash": "2b3011daceeab1eb43062f8096d559829f0fc387688298f8977b77deb7975399",
"sha": "5fee38eb16b76634495d19760bb4299ea258fd18",
"hash": "621cfd0244b8b94188ec6c525093eff06b11475d5e866ead7ee11b02b589591a",
"sha": "0a5957bffde5b7b2e4d33f6dae5f75c982ee93e6",
"source": "ncmake"
},
"lint-info-xml.yml": {
Expand Down Expand Up @@ -40,8 +40,8 @@
"source": "nextcloud"
},
"workflow-updater.yml": {
"hash": "8461d0138be309fe7efb500b7ecf044be88f9138199241f41a7d4ecad37dced0",
"sha": "1adddbae13390821da9dd50c8fbedcb16290da18",
"hash": "51db7ca85627ed5b4641677a577672df724936608152e3a36eef9f90da36e100",
"sha": "d81ef339dca007a84367431100725c64b7de2c74",
"source": "ncmake"
}
}
3 changes: 2 additions & 1 deletion .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# ncmake branch cleanup: when a pull request is merged, delete its head branch
# if it is still there. This is the workflow-shipped equivalent of the
# repository "Automatically delete head branches" setting (see
# doc/DELETE_MERGED_BRANCHES.md): unlike that per-repository toggle it travels
# https://github.com/ernolf/ncmake/wiki/Deleting-merged-branches): unlike that
# per-repository toggle it travels
# with the repository through `make workflows-install`, so a repository gets the
# cleanup even when no admin has flipped the setting. Running both is harmless:
# whichever removes the branch first wins and the other is a quiet no-op.
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/workflow-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
# GITHUB_TOKEN may not push workflow files, and it is preferred over a PAT
# because the same token both pushes the files and produces verified, signed
# commits. Store its credentials as the NCMAKE_UPDATER_CLIENT_ID and
# NCMAKE_UPDATER_PRIVATE_KEY secrets. See doc/AUTOUPDATE_WORKFLOW.md and
# doc/GITHUB_APP.md.
# NCMAKE_UPDATER_PRIVATE_KEY secrets. See
# https://github.com/ernolf/ncmake/wiki/Workflow-updater and
# https://github.com/ernolf/ncmake/wiki/GitHub-App.

name: ncmake workflow update

on:
schedule:
# Daily at 05:30 UTC. GitHub starts scheduled runs on a best-effort basis and
# delays them under load, so expect this a few hours late, not on the minute
# (see doc/AUTOUPDATE_WORKFLOW.md). Trigger workflow_dispatch to run without
# (see https://github.com/ernolf/ncmake/wiki/Workflow-updater). Trigger
# workflow_dispatch to run without
# waiting for the schedule.
- cron: '30 5 * * *'
workflow_dispatch:
Expand Down Expand Up @@ -87,7 +89,8 @@ jobs:
# App as the update job, so it always has Contents: write regardless of the
# repository's default token permissions. This only ever touches
# ncmake/ci/workflow-update, and is unrelated to the repository-wide
# "Automatically delete head branches" setting (see doc/DELETE_MERGED_BRANCHES.md).
# "Automatically delete head branches" setting
# (see https://github.com/ernolf/ncmake/wiki/Deleting-merged-branches).
if: >-
github.event_name == 'pull_request'
&& github.event.pull_request.merged == true
Expand All @@ -101,9 +104,18 @@ jobs:
client-id: ${{ secrets.NCMAKE_UPDATER_CLIENT_ID }}
private-key: ${{ secrets.NCMAKE_UPDATER_PRIVATE_KEY }}

- name: Delete the merged updater branch
- name: Delete the merged updater branch if it is still there
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh api --method DELETE \
"repos/${{ github.repository }}/git/refs/heads/ncmake/ci/workflow-update"
ref="repos/${{ github.repository }}/git/refs/heads/ncmake/ci/workflow-update"
# The repository's "Automatically delete head branches" setting, or a
# fast-clicking admin, may have removed the branch already. Only delete
# what is still there, and tolerate it vanishing between the check and
# the delete, so a redundant run is a quiet no-op, not a failure.
if gh api "$ref" >/dev/null 2>&1; then
gh api --method DELETE "$ref" \
|| echo "Branch was removed concurrently; nothing to do."
else
echo "Branch already deleted; nothing to do."
fi
Loading