Skip to content

Commit

Permalink
add install github app warning (#40)
Browse files Browse the repository at this point in the history
* add install github app warning

* update README.md
  • Loading branch information
qelphybox authored May 30, 2021
1 parent b7479f0 commit 01693a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This action automatically approves and merges dependabot PRs.

## Usage

- install the [GitHub App](https://github.com/apps/dependabot-merge-action) on the repositories or organization where you want to use this action. Using a GitHub App is necessary since [this change](https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/) GitHub introduced which limits the permissions of the provided GITHUB_TOKEN and the availability of secrets in Dependabot pull requests. The source [code of the GitHub App](https://github.com/fastify/dependabot-merge-action-app/) is open source and hosted on Google Cloud Platform. You can also host your own version of the app and customize the `api-url` input to point to your hosted instance.
- **install the [GitHub App](https://github.com/apps/dependabot-merge-action) on the repositories or organization where you want to use this action.** Using a GitHub App is necessary since [this change](https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/) GitHub introduced which limits the permissions of the provided GITHUB_TOKEN and the availability of secrets in Dependabot pull requests. The source [code of the GitHub App](https://github.com/fastify/dependabot-merge-action-app/) is open source and hosted on Google Cloud Platform. You can also host your own version of the app and customize the `api-url` input to point to your hosted instance.
- configure this action in your workflows providing the inputs described below

## Inputs
Expand Down
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6203,6 +6203,8 @@ const {
API_URL,
} = getInputs()

const GITHUB_APP_URL = 'https://github.com/apps/dependabot-merge-action'

async function run() {
try {
const { pull_request: pr } = github.context.payload
Expand Down Expand Up @@ -6245,6 +6247,10 @@ async function run() {

const responseText = await response.text()

if (response.status === 400) {
logWarning(`Please ensure that Github App is installed ${GITHUB_APP_URL}`)
}

if (!response.ok) {
throw new Error(
`Request failed with status code ${response.status}: ${responseText}`
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const {
API_URL,
} = getInputs()

const GITHUB_APP_URL = 'https://github.com/apps/dependabot-merge-action'

async function run() {
try {
const { pull_request: pr } = github.context.payload
Expand Down Expand Up @@ -58,6 +60,10 @@ async function run() {

const responseText = await response.text()

if (response.status === 400) {
logWarning(`Please ensure that Github App is installed ${GITHUB_APP_URL}`)
}

if (!response.ok) {
throw new Error(
`Request failed with status code ${response.status}: ${responseText}`
Expand Down

0 comments on commit 01693a8

Please sign in to comment.