File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check for assets
2+
3+ on :
4+ issues :
5+ types : [opened, edited]
6+ issue_comment :
7+ types : [created, edited]
8+ pull_request :
9+ types : [opened, edited]
10+
11+ jobs :
12+ check-assets :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v2
17+
18+ - name : Check for assets
19+ uses : actions/github-script@v5
20+ with :
21+ script : |
22+ const issueOrPrBody = context.payload.issue?.body || context.payload.pull_request?.body || context.payload.comment?.body;
23+ if (issueOrPrBody.includes('/assets')) {
24+ const fs = require('fs');
25+ const issueOrPrLink = context.payload.issue?.html_url || context.payload.pull_request?.html_url || context.payload.comment?.html_url;
26+ const repoName = context.repo.repo;
27+ fs.writeFileSync('assets.txt', `Issue/PR link: ${issueOrPrLink}\nRepo name: ${repoName}`);
28+ }
29+
30+ - name : Commit and push if changes
31+ run : |
32+ git config --local user.email "[email protected] " 33+ git config --local user.name "GitHub Action"
34+ git add -A
35+ if git diff --staged --quiet; then
36+ echo "No changes to commit"
37+ else
38+ git commit -m "Add assets.txt"
39+ git push
40+ fi
You can’t perform that action at this time.
0 commit comments