Skip to content

Commit

Permalink
Add gha, keywords, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ClydeDz committed Aug 3, 2024
1 parent dc9b394 commit 7c03430
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Build and publish npm package"

on:
push:
branches:
- main
paths-ignore:
- README.md
pull_request:
branches:
- main
paths-ignore:
- README.md

jobs:
build_publish:
name: Build and publish npm package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: npm ci

- name: Publish package to npm
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}

- if: ${{ steps.publish.outputs.type }}
run: |
echo "Version changed!"
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

Netlify plugin that updates GitHub commit status with the latest deployment progress.

## How to use this?

The following environment variables will need to be added to your Netlify environment variables for this plugin to work.

```
GITHUB_TOKEN=<INSERT YOUR TOKEN HERE>
GITHUB_REPO_OWNER=<GITHUB USERNAME>
GITHUB_REPO_NAME=<GITHUB REPOSITORY>
```

Example:

```
GITHUB_TOKEN=github_pat_XXYYXXXX00123456
GITHUB_REPO_OWNER=clydedz
GITHUB_REPO_NAME=netlify-plugin-github-deploy-status
```

Note:

- Ideally, the `GITHUB_REPO_NAME` should be the same repository that your Netlify site is connected with.
- Netlify will automatically populate `COMMIT_REF` with the GitHub commit hash. No action required on this.
- When creating the GitHub token, add the "read and write" permissions for Commit statuses for this token. This token must be associated with the repository given in the `GITHUB_REPO_NAME` environment variable.

## Credits

Developed by [Clyde D'Souza](https://clydedsouza.net/)
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"url": "git+https://github.com/ClydeDz/netlify-plugin-github-deploy-status.git"
},
"keywords": [
"github"
"github",
"netlify-plugin",
"netlify"
],
"author": "Clyde D'Souza",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/index.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fetch = require("node-fetch");

const updateGithub = async (utils, state, description) => {
const commitSha = process.env.COMMIT_REF;
const commitSha = process.env.COMMIT_REF; // When developing locally, replace this with an actual value
const repoOwner = process.env.GITHUB_REPO_OWNER;
const repoName = process.env.GITHUB_REPO_NAME;
const githubToken = process.env.GITHUB_TOKEN;
Expand Down

0 comments on commit 7c03430

Please sign in to comment.