Skip to content

cron to review acceptances (develop) #4

cron to review acceptances (develop)

cron to review acceptances (develop) #4

name: "Channel Invites Acceptances (develop)"
run-name: "cron to review acceptances (develop)"
on:
push:
branches:
- feature-workflows
#schedule:
#- cron: "0 0 * * 0"
jobs:
cron:
runs-on: "ubuntu-latest"
env:
CHANNEL: ${{ secrets.ST_CHANNEL_DEVELOP }}
ST_TOKEN: ${{ secrets.ST_PAT }}
steps:
- name: "checkout"
uses: "actions/checkout@v3"
- name: "setup smartthings cli"
uses: "actions/setup-node@v3"
with:
node-version: "20.9.0"
- run: "npm install --global @smartthings/cli"
- name: "test step"
run: "git status"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: "update channel information"
uses: "actions/checkout@v3"
- run: |
CHANNEL_INFO=$(smartthings edge:channels:invites "$CHANNEL" --json --token "$TOKEN");
NAME=$(echo $CHANNEL_INFO | jq .metadata.name);
OWNER=$(echo $CHANNEL_INFO | jq .metadata.owner);
DESCRIPTION=$(echo $CHANNEL_INFO | jq .metadata.description);
TERMS=$(echo $CHANNEL_INFO | jq .metadata.termsUrl);
ACCEPTANCES=$(echo $CHANNEL_INFO | jq .acceptances);
ACCEPT_URL=$(echo $CHANNEL_INFO | jq .acceptUrl);
python -c "
from sys import argv
template = '''
- **Name**: {}
- **Owner**: {}
- **Description**: {}
- **Terms URL**: {}
- **Acceptances**: {}
<a href=\"{}\">Accept Invite</a>
'''
template = template.format(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6])
content = None
with open('readme_template', 'r') as template_doc:
tag = 'channel-info-here'
content = template_doc.read()
content = content.replace(tag, template)
with open('README.md', 'w') as readme:
readme.write(content)
" "$NAME" "$OWNER" "$DESCRIPTION" "$TERMS" "$ACCEPTANCES" "$ACCEPT_URL";
cat README.md;