Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add commisery GitHub action #15

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/commisery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (C) 2020-2020, TomTom (http://tomtom.com).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Commisery
on:
pull_request:
types: [edited, opened, synchronize, reopened]

jobs:
commit-message:
name: Conventional Commit Message Checker (Commisery)
runs-on: ubuntu-latest
steps:
- name: Check-out the repo under $GITHUB_WORKSPACE
uses: actions/checkout@v2

- name: Run Commisery
uses: enarx/commisery-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull_request: ${{ github.event.number }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this action require our GITHUB_TOKEN? What permissions are we granting to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an automatically generated GITHUB_TOKEN for pulling the repository: https://github.com/enarx/commisery-action/blob/ecedfc765564e89b9a776bfea8d5717c686b15ad/commisery_action.py#L69

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is unnecessary for a public repo. You should submit a PR to make the token optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunately unfeasible, as this requires putting in a PR for the GitHub Python API library to not require a GITHUB_TOKEN. What I think is a better alternative is to simply restrict the access which GITHUB_TOKEN provides via: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/