Skip to content

Commit

Permalink
Merge pull request #147 from bgilbert/monitoring
Browse files Browse the repository at this point in the history
workflows: automatically recheck for updates when issue is closed
  • Loading branch information
bgilbert authored Oct 1, 2023
2 parents 8213d77 + 87e52d1 commit 844ec66
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 58 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/event-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Privileged workflow to process issue events

name: Issue event

on:
issues:
types: [opened, closed]

permissions:
issues: write

env:
GH_LABEL: update

jobs:
issue-event:
name: Process
runs-on: ubuntu-latest
outputs:
bot-user: ${{ steps.bot-user.outputs.username }}
steps:
- name: Get bot username
id: bot-user
env:
GITHUB_TOKEN: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
run: echo "username=$(gh api user -q .login)" >> $GITHUB_OUTPUT
- name: Label dependency issue
if: >-
github.event.action == 'opened' &&
github.actor == steps.bot-user.outputs.username &&
contains(github.event.issue.body, 'topic=dependencies')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh issue edit -R "${{ github.repository }}" \
"${{ github.event.issue.number }}" \
--add-label $GH_LABEL
update-from-issue:
name: Check for updates
needs: issue-event
if: >-
github.event.action == 'closed' &&
github.event.issue.user.login == needs.issue-event.outputs.bot-user &&
contains(github.event.issue.body, 'topic=dependencies')
uses: ./.github/workflows/update-check.yml
secrets: inherit
35 changes: 35 additions & 0 deletions .github/workflows/event-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Privileged workflow to process PR events

name: PR event

on:
pull_request_target:
branches: [main]
types: [opened]

permissions:
pull-requests: write

env:
GH_LABEL: update

jobs:
pr-event:
name: Process
runs-on: ubuntu-latest
steps:
- name: Get bot username
id: bot-user
env:
GITHUB_TOKEN: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
run: echo "username=$(gh api user -q .login)" >> $GITHUB_OUTPUT
- name: Label dependency PR
if: >-
github.actor == steps.bot-user.outputs.username &&
contains(github.event.pull_request.body, 'topic=dependencies')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit -R "${{ github.repository }}" \
"${{ github.event.number }}" \
--add-label $GH_LABEL
6 changes: 6 additions & 0 deletions .github/workflows/update-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ on:
paths: ['meson/subprojects/*.wrap']
schedule:
- cron: '0 12 * * 1'
workflow_call:
workflow_dispatch:

permissions:
contents: none

concurrency: update-check

env:
GIT_BRANCH: update-${{ github.repository_owner }}
GIT_NAME: OpenSlide Automation
Expand Down Expand Up @@ -78,6 +81,9 @@ jobs:
$(cat stale-report)
\`\`\`
I will automatically check wrapdb for updates when this issue is \
closed.
<!-- topic=dependencies -->"
if [ -z "$issue" ]; then
echo "Creating issue..."
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/update-label.yml

This file was deleted.

0 comments on commit 844ec66

Please sign in to comment.