Skip to content

Commit

Permalink
v0.7.0 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Page committed Apr 29, 2021
1 parent 58d6d3b commit 563bf6f
Show file tree
Hide file tree
Showing 14 changed files with 7,723 additions and 6,707 deletions.
File renamed without changes.
16 changes: 16 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contributing

## Local development

To set up the action for local development and testing:

1. Create a fork of the github-project-automation-plus
2. Create a new repository with a project
3. Add a workflow file that changes the `uses` to your forked repository: `uses: my-fork/github-project-automation-plus@main`
3. Make changes to your action and deploy them to GitHub

## Release a new version

1. Run `yarn build`
2. Push the changes to the `main` branch
3. Create a [new release](https://github.com/alex-page/github-project-automation-plus/releases/new)
7 changes: 3 additions & 4 deletions .github/workflows/test-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: |
npm i
npm run test
- uses: actions/checkout@main
- run: npm i
- run: npm run test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Alex Page
Copyright (c) 2021 Alex Page

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
48 changes: 16 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
Change these options in the workflow `.yml` file to meet your GitHub project needs.

| Setting | Description | Values |
| Inputs | Description | Values |
| --- | --- | --- |
| `on` | When the automation is ran | `issues` `pull_request` `issue_comment` `pull_request_target` `pull_request_review` |
| `types` | The types of activity that will trigger a workflow run. | `opened`, `assigned`, `edited`: [See GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request) for more |
Expand All @@ -71,39 +71,28 @@ Change these options in the workflow `.yml` file to meet your GitHub project nee
| `repo-token` | The personal access token | `${{ secrets.GITHUB_TOKEN }}` |
| `action` | This determines the type of the action to be performed on the card, Default: `update` | `update`, `delete`, `archive` |

## Personal access token (secrets.GITHUB_TOKEN)
## Personal access token

Depending on your project set up you may be able to use [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) which requires no set up. This is only possible when the project and repository are owned by your account.
Most of the time [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) will work as your `repo-token`. This requires no set up. If you have a public project board and public repository this is the option for you.

For forked and private repositories this error occurs:
**Private repository or organisation projects**

```shell
GraphqlError: Resource not accessible by integration
```

**Secrets are not currently available to forks.** This error happens on forked repositories because [`GITHUB_TOKEN` only has read permissions](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token).
You will need a personal access token to send events from your issues and pull requests.

On private repositories you may need to enable policy settings to allow running workflows from forks.
Please refer to GitHub's documentation to learn about enabling these settings at [enterprise](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-enterprise-account/enforcing-github-actions-policies-in-your-enterprise-account#enabling-workflows-for-private-repository-forks), [organization](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-organizations-and-teams/disabling-or-limiting-github-actions-for-your-organization?algolia-query=private+repositor#enabling-workflows-for-private-repository-forks), or [repository](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#enabling-workflows-for-private-repository-forks) level.
1. Create a personal access token
1. [Private repository or private project](https://github.com/settings/tokens/new?scopes=repo&description=GHPROJECT_TOKEN)
1. [Organisation project board or organisation repository](https://github.com/settings/tokens/new?scopes=repo,write:org&description=GHPROJECT_TOKEN)

Alternatively, you can perform following steps:
1. Create a [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line). See the below guide on how to [configure the permissions](#permissions-for-personal-access-tokens).
2. [Create a secret](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) containing the personal access token, call it `GH_TOKEN`
3. Change the `repo-token` in the workflow `.yml` to reference your new token name:
1. [Add a secret](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) `GHPROJECT_TOKEN` with the personal access token.
1. Update the `repo-token` in the workflow `.yml` to reference your new token name:
```yaml
repo-token: ${{ secrets.GH_TOKEN }}
repo-token: ${{ secrets.GHPROJECT_TOKEN }}
```

### Permissions for personal access tokens

| Repo and project board | Permission |
| --- | --- |
| Public repository and project board | [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) |
| Private repository and project board | `Full control of private repositories` |
| Organisation public or private project board and repository | `Read and write org and team membership, read and write org projects` |

## Troubleshooting

**GraphqlError: Resource not accessible by integration** and **Secrets are not currently available to forks.** This error happens on forked repositories because [`GITHUB_TOKEN` only has read permissions](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token).

**SAML enforcement**

With certain organisations there may be SAML enforcement. This means you will need to `Enable SSO` when you create the personal access token.
Expand All @@ -115,19 +104,14 @@ GraphqlError: Resource protected by organization SAML enforcement. You must gran
Make sure your permissions for your personal access token are correctly configured. Follow the above [guide on permissions](#permissions-for-personal-access-tokens).
**Private repositories**
## Local development
To set up the action for local development and testing:
1. Create a fork of the github-project-automation-plus
2. Create a new repository with a project
3. Add a workflow file that changes the `uses` to your forked repository: `uses: my-fork/github-project-automation-plus@main`
3. Make changes to your action and deploy them to GitHub
You may need to enable policy settings to allow running workflows from forks. Please refer to GitHub's documentation to learn about enabling these settings at [enterprise](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-enterprise-account/enforcing-github-actions-policies-in-your-enterprise-account#enabling-workflows-for-private-repository-forks), [organization](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-organizations-and-teams/disabling-or-limiting-github-actions-for-your-organization?algolia-query=private+repositor#enabling-workflows-for-private-repository-forks), or [repository](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#enabling-workflows-for-private-repository-forks) level.
## Release History
- v0.7.0 - Update documentation and dependencies
- v0.6.0 - Add support for `pull_request_target` and `pull_request_review`
- v0.5.1 - Fix get event data from issue_coment
- v0.5.0 - Add option to `delete` card
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
required: false
default: "update"
runs:
using: 'node12'
using: 'node14'
main: 'dist/index.js'
branding:
icon: 'cpu'
Expand Down
14 changes: 13 additions & 1 deletion dist/index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 563bf6f

Please sign in to comment.