Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: automatically recheck for updates when issue is closed #147

Merged
merged 4 commits into from
Oct 1, 2023
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
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.