Pin dependencies #162
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: Update Code | |
on: | |
issue_comment: | |
types: [created, edited] | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
jobs: | |
update: | |
name: Formatting code | |
runs-on: ubuntu-18.04 | |
if: ${{ contains(github.event.comment.body, 'update_code') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: Checkout Pull Request | |
run: hub pr checkout ${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Formatting | |
uses: axel-op/googlejavaformat-action@v3 | |
with: | |
args: "--replace" | |
commit-message: "Google Java format [skip ci]" | |
notify: | |
needs: [ update ] | |
runs-on: ubuntu-latest | |
name: Notify | |
if: ${{ always() && contains(needs.*.result, 'failure') }} | |
steps: | |
- name: Notify if Failure | |
uses: actions/github-script@v6.3.3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
var comments = await github.rest.issues.listComments({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}); | |
for (const comment of comments.data) { | |
if (comment.body.includes('Update Code is failed. Please retry.')){ | |
github.rest.issues.deleteComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: comment.id | |
}) | |
} | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Update Code is failed. Please retry.' | |
}) | |
core.setFailed('Update Code is failed. Please retry.') |