Skip to content

[Reservation] New Reservation Request #11

[Reservation] New Reservation Request

[Reservation] New Reservation Request #11

name: Process Issue Closed
on:
issues:
types:
- closed
permissions:
contents: read
id-token: write
issues: write
pull-requests: write
jobs:
cancel:
name: (Issue Closed) Cancel Reservation
runs-on: ubuntu-latest
# This job should only be run when the following conditions are true:
#
# - The issue has the `reservation` label.
# - The user who closed the issue is not the IssueOps bot (prevents infinite
# loops).
#
# Since the request is being cancelled, we don't need to check if it is
# valid. It can just be closed.
if: |
contains(github.event.issue.labels.*.name, 'reservation') == true &&
github.actor != 'issueops-bot[bot]'
steps:
# This is required to ensure the issue form template is included in the
# workspace. However, we don't need to install any dependencies since we
# aren't running validation on closed issues.
- name: Checkout
id: checkout
uses: actions/checkout@v4
# GitHub App authentication is required if you want to interact with any
# resources outside the scope of the repository this workflow runs in.
- name: Get GitHub App Token
id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.ISSUEOPS_APP_ID }}
private-key: ${{ secrets.ISSUEOPS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
# Parse the issue body into machine-readable JSON, so that it can be
# processed by the rest of the workflow.
- name: Parse Issue body
id: parse
uses: issue-ops/parser@v4
with:
body: ${{ github.event.issue.body }}
issue-form-template: reservation.yml
workspace: ${{ github.workspace }}
# Process the cancellation request.
- name: Process Reservation Request
id: process
# When using custom actions, make sure to pin the version to a specific
# commit or release tag!
uses: issue-ops/demo-reservation-action@main
with:
action: cancel
github_token: ${{ steps.token.outputs.token }}
issue_body: ${{ steps.parse.outputs.json }}
issue_template_path: .github/ISSUE_TEMPLATE/reservation.yml
project_number: 3