Skip to content

Pin dependencies

Pin dependencies #31

Workflow file for this run

name: Check PR
# Controls when the workflow will run
on:
pull_request:
branches:
- main
types: [ opened, synchronize, labeled, unlabeled, reopened, edited ]
permissions:
pull-requests: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check_labels:
name: Check Required Labels
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Verify PR Labels
if: ${{ !contains(github.event.pull_request.labels.*.name, 'patch') && !contains(github.event.pull_request.labels.*.name, 'ignore-for-release') }}
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # 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('This pull request does not contain a valid label')){
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: 'This pull request does not contain a valid label. Please add one of the following labels: `[patch, ignore-for-release]`'
})
core.setFailed('Missing required labels')
check_format:
name: Check Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Formatting
id: format
continue-on-error: true
uses: axel-op/googlejavaformat-action@v3
with:
args: "--set-exit-if-changed"
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
if: steps.format.outcome != 'success'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log(context);
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) {
console.log(comment);
if (comment.body.includes('Comment this PR with')){
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: 'Comment this PR with *update_code* to format the code. Consider to use pre-commit to format the code.'
})
core.setFailed('Format your code.')
check_size:
runs-on: ubuntu-latest
name: Check Size
steps:
- name: Dump GitHub context
run: echo $JSON
env:
JSON: ${{ toJSON(github) }}
- name: Check PR Size
uses: pagopa/github-actions-template/check-pr-size@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
ignored_files: 'openapi.json'