Skip to content

Commit

Permalink
feature: testing cron workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
erickvneri committed Feb 13, 2024
1 parent 0075202 commit 1e7d16e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/cron-develop-invites-acceptances.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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: "setup python"
uses: "actions/setup-python@v3"
with:
python-version: 3.11

- 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 "$ST_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);
echo $TERMS;
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;
Empty file.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Edge Drivers for Zigbee and LAN devices

### Channel

- Name: erick
- Owner: lala
- Description: cas
- Terms URL: ca
- Acceptances: dasf

<a href="adsf">Accept Invite</a>


### Index

- [Zigbee Edge Drivers](./zigbee)
- [Zigbee Edge Drivers](./zigbee)
7 changes: 7 additions & 0 deletions readme_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Edge Drivers for Zigbee and LAN devices

### Channel
channel-info-here
### Index

- [Zigbee Edge Drivers](./zigbee)

0 comments on commit 1e7d16e

Please sign in to comment.