Skip to content

Kotlin migration

Kotlin migration #5589

Workflow file for this run

# https://github.com/peter-evans/create-pull-request/blob/master/docs/examples.md#autopep8
name: auto-format
on: pull_request
jobs:
auto-format:
# Check if the PR is not raised by this workflow and is not from a fork
if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup node 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: install [email protected]
run: npm install -g --save-exact [email protected]
- name: prettier
run: npx prettier --write protocol/**/*.json
- name: embedme
run: |
cd docs
./embedme.sh < protocol.md > protocol2.md && mv protocol2.md protocol.md
./embedme.sh < messageData.md > messageData2.md && mv messageData2.md messageData.md
# TODO: debug why doctoc doesn't produce the expected output
# - name: doctoc
# run: |
# cd docs
# ./doctoc.sh protocol.md
# ./doctoc.sh messageData.md
- name: Check for modified files
id: git-check
run: |
echo $(git diff-index HEAD)
echo $(git status --porcelain)
echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Set auto-format branch name
id: vars
run: echo ::set-output name=branch-name::"auto-format-patches/${{ github.head_ref }}"
- name: Create Pull Request
id: cpr
if: steps.git-check.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v3
with:
commit-message: auto-format action fixes
title: Fixes by auto-format action
body: This is an auto-generated PR with fixes by auto-format for PR \#${{github.event.number}}.
labels: auto-format, automated pr
branch: ${{ steps.vars.outputs.branch-name }}
reviewers: ${{ github.event.pull_request.user.login }}
delete-branch: true
- name: Add comment if auto-format made changes
if: steps.git-check.outputs.modified == 'true'
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🟠 There seems to be some formatting issues that must be applied from PR ${{ steps.cpr.outputs.pull-request-url }} first.'
})
- name: Fail if auto-format made changes
if: steps.git-check.outputs.modified == 'true'
run: exit 1