File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66jobs :
77 update :
88 runs-on : ubuntu-latest
9+ permissions :
10+ contents : write # Grant write permissions
911 steps :
1012 - name : Checkout repository
1113 uses : actions/checkout@v2
2426 env :
2527 ISSUE_BODY : ${{ github.event.issue.body }}
2628 run : |
27- echo "$ISSUE_BODY" > issue_body.json
2829 python update_library.py
2930
3031 - name : Commit changes
3334 git config --global user.email "actions@github.com"
3435 git add data/library.json data/library.csv
3536 git commit -m "Update library data"
36- git push
37+ git push origin HEAD:${{ github.ref }}
38+ - name : Close issue
39+ if : success() && github.event.issue.state == 'open'
40+ uses : peter-evans/close-issue@v2
41+ with :
42+ issue-number : ${{ github.event.issue.number }}
43+ comment : " Library updated successfully and issue closed."
44+ reason : completed
45+ - name : Handle failure
46+ if : failure()
47+ uses : actions/github-script@v6
48+ with :
49+ script : |
50+ const issue_number = context.payload.issue.number;
51+ const comment = "There was an error updating the library. Please check the logs for details.";
52+ await github.issues.createComment({
53+ ...context.repo,
54+ issue_number,
55+ body: comment
56+ });
57+ await github.issues.update({
58+ ...context.repo,
59+ issue_number,
60+ state: 'open'
61+ });
62+
You can’t perform that action at this time.
0 commit comments