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: added permissions (pull-requests: read) setting to workflow and README example #215

Merged
merged 10 commits into from May 16, 2023
7 changes: 5 additions & 2 deletions .github/workflows/lint-pr-title-preview-ignoreLabels.yml
Expand Up @@ -8,12 +8,15 @@ on:
- labeled
- unlabeled

permissions:
pull-requests: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand Down
Expand Up @@ -6,12 +6,15 @@ on:
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand Down
Expand Up @@ -6,12 +6,15 @@ on:
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint-pr-title-preview.yml
Expand Up @@ -6,12 +6,15 @@ on:
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint-pr-title.yml
Expand Up @@ -6,12 +6,15 @@ on:
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: ./
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Expand Up @@ -4,12 +4,18 @@ on:
branches:
- main

permissions:
contents: read
deployments: write
issues: write
pull-requests: write

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -6,12 +6,15 @@ on:
- reopened
- synchronize

permissions:
contents: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install
Expand All @@ -20,7 +23,7 @@ jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if `dist/` has been modified.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/versioning.yml
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [published, edited]

permissions:
deployments: write

jobs:
actions-tagger:
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions README.md
Expand Up @@ -30,6 +30,9 @@ on:
- edited
- synchronize

permissions:
natterstefan marked this conversation as resolved.
Show resolved Hide resolved
pull-requests: read

jobs:
main:
name: Validate PR title
Expand Down Expand Up @@ -111,6 +114,21 @@ feat(ui): Add `Button` component
wip: true
```

### Required Permissions for [WIP] feature

If you want to use the `[WIP]` feature, you need to grant the
`pull-requests: write` permission to the GitHub Action. This is because the
action will update the status of the PR.

```yml
name: "Lint PR"

# ...

permissions:
pull-requests: write
```

Copy link
Owner

Choose a reason for hiding this comment

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

Looks pretty good!

Maybe we can move the whole config option for wip to this block, similar to what we've done with the legacy configuration below? I'm just worried that users stop reading at the wip option above and don't notice that permissions need to be changed (even though it's the very next headline).

By doing this, we can make sure we're educating users about the required permissions as we're introducing the feature. Maybe you can reuse the description from above here and adjust the headline accordingly to match the whole section?

I just noticed the "Note that a second check will be reported if this is enabled." part is no longer valid, can you remove this as part of moving the text?

Thank you so much! 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @amannn,

please review again and take a look at:

Copy link
Owner

Choose a reason for hiding this comment

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

Looks great, thanks! I've included a commit with a few further README improvements that I had on my list to include them in the next release.

## Event triggers

There are two events that can be used as triggers for this action, each with different characteristics:
Expand All @@ -137,6 +155,9 @@ on:
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
Expand Down