Data Download test #3
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: Respond to Cache Data Command | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
respond-to-cache-command: | |
runs-on: ubuntu-latest | |
if: contains(github.event.comment.body, '@roboneuro cache data for https://github.com/') | |
steps: | |
- name: Check for Cache Data Command Pattern | |
id: check-pattern | |
run: | | |
COMMENT_BODY="${{ github.event.comment.body }}" | |
if [[ "$COMMENT_BODY" =~ @roboneuro\ cache\ data\ for\ (https://github.com/[^ ]+) ]]; then | |
REPO_URL="${BASH_REMATCH[1]}" | |
echo "repository_url=$REPO_URL" >> $GITHUB_ENV | |
else | |
echo "No valid cache data command found." | |
exit 1 | |
fi | |
- name: Comment with Download Message | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.BOT_TOKEN }} | |
script: | | |
const repoUrl = process.env.repository_url; | |
const repoOwner = repoUrl.replace('https://github.com/', ''); | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Downloading data for ${repoOwner}` | |
}); |