request-command #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Request workflow | |
on: | |
repository_dispatch: | |
types: [request-command] | |
jobs: | |
generatevalues: | |
name: Generate values | |
runs-on: ubuntu-latest | |
env: | |
ISSUE_NUM: ${{ github.event.client_payload.github.payload.issue.number }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set defaults for all inputs | |
id: defs | |
run: | | |
SRCURL=${{ github.event.client_payload.slash_command.args.named.source || '' }} | |
if [ -z "$SRCURL" ]; then | |
SRCURL="https://github.com/${{github.repository}}/issues/$ISSUE_NUM" | |
fi | |
echo source=$SRCURL >> $GITHUB_OUTPUT | |
IDINPUT=${{ github.event.client_payload.slash_command.args.named.id || 'error' }} | |
echo id=$IDINPUT >> $GITHUB_OUTPUT | |
echo title=${{ github.event.client_payload.slash_command.args.named.title || 'No title' }} >> $GITHUB_OUTPUT | |
echo description=${{ github.event.client_payload.slash_command.args.named.description || '' }} >> $GITHUB_OUTPUT | |
echo section=${{ github.event.client_payload.slash_command.args.named.section || 'Others' }} >> $GITHUB_OUTPUT | |
echo docker=${{ github.event.client_payload.slash_command.args.named.docker || '' }} >> $GITHUB_OUTPUT | |
echo port=${{ github.event.client_payload.slash_command.args.named.port || '8787' }} >> $GITHUB_OUTPUT | |
CMDSTRING=${{ github.event.client_payload.slash_command.args.named.command }} | |
if [ -z $CMDSTRING ]; then CMDSTRING='echo "setwd(\"/home/rstudio\"); setHook(\"rstudio.sessionInit\", function(newSession) { if (newSession) rstudioapi::filesPaneNavigate(getwd()) }, action = \"append\")" > /home/rstudio/.Rprofile; /init'; fi | |
echo command=$CMDSTRING >> $GITHUB_OUTPUT | |
echo pkglist=${{ github.event.client_payload.slash_command.args.named.pkglist || '' }} >> $GITHUB_OUTPUT | |
echo vignettes=${{ github.event.client_payload.slash_command.args.named.vignettes || '' }} >> $GITHUB_OUTPUT | |
rm -f generated/${IDINPUT}.* | |
- name: Test initial request | |
id: reqtest | |
run: bash .github/scripts/request.sh -i '${{steps.defs.outputs.id}}' -t '${{steps.defs.outputs.title}}' -d '${{steps.defs.outputs.description}}' -s '${{steps.defs.outputs.section}}' -u '${{steps.defs.outputs.source}}' -c '${{steps.defs.outputs.docker}}' -p '${{steps.defs.outputs.port}}' -m '${{steps.defs.outputs.command}}' -k '${{steps.defs.outputs.pkglist}}' -v '${{steps.defs.outputs.vignettes}}' | |
continue-on-error: true | |
- name: Create comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
issue-number: ${{ github.event.client_payload.github.payload.issue.number }} | |
body: | | |
_AUTO-GENERATED RESPONSE_ | |
Your request has been received and has passed initial screening. :sparkles: | |
Below are the detected values: | |
``` | |
id='${{steps.defs.outputs.id}}' | |
title='${{steps.defs.outputs.title}}' | |
description='${{steps.defs.outputs.description}}' | |
section='${{steps.defs.outputs.section}}' | |
source='${{steps.defs.outputs.source}}' | |
docker='${{steps.defs.outputs.docker}}' | |
port='${{steps.defs.outputs.port}}' | |
command='${{steps.defs.outputs.command}}' | |
pkglist='${{steps.defs.outputs.pkglist}}' | |
vignettes='${{steps.defs.outputs.vignettes}}' | |
``` | |
If these are as expected, no further action is needed at this time. Please wait for an admin's response. | |
If any changes are needed, please re-run the /request action with desired values. | |
if: steps.reqtest.outcome=='success' | |
- name: Create comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
issue-number: ${{ github.event.client_payload.github.payload.issue.number }} | |
body: | | |
_AUTO-GENERATED RESPONSE_ | |
Your request has been received but is currently failing initial screening. | |
Please retry your request ensuring all parameters are passed in correctly. | |
if: steps.reqtest.outcome=='failure' | |