Skip to content

Commit

Permalink
ci(OS-798): fixes 2 bugs in subgraph and npm releated workflows (#491)
Browse files Browse the repository at this point in the history
* ci: wrong comparison in npm-release workflow

* ci: possible fix for subgraph deploy issue

updating the changelog requires a commit that needs to be signed, github
actions cannot do that easily. this is a possible solution for this
problem
  • Loading branch information
mathewmeconry authored Oct 25, 2023
1 parent 835b398 commit 4f9efb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: echo "run=true" >> $GITHUB_OUTPUT
npmDeploy:
needs: ['check']
if: needs.check.outputs.run != true
if: needs.check.outputs.run == true
uses: './.github/workflows/npm-release-reusable.yml'
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/subgraph-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: Subgraph Deploy

on:
workflow_dispatch:
workflow_dispatch:
pull_request:
types:
- closed
Expand All @@ -13,6 +13,7 @@ on:
- main
paths:
- 'packages/subgraph/package.json'
- '.github/workflows/subgraph-deploy.yaml'

jobs:
# The prepare job is responsible for preparing the environment and generating outputs for other jobs.
Expand All @@ -37,6 +38,10 @@ jobs:
github.event.pull_request.merged &&
github.actor != 'arabot-1' &&
contains(toJson(github.event.pull_request.labels.*.name), 'subgraph:deploy')
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -46,17 +51,14 @@ jobs:
run: |
VERSION=$(cat package.json | jq -r .version)
sed -i "s/^\#\# \[UPCOMING\]/## [UPCOMING]\n\n\## $VERSION\nOn $(date +'%Y-%m-%d %H:%M:%S')/" "./CHANGELOG.md"
- name: Commit changes
id: commit
run: |
git fetch
git pull
git config --global user.name "Arabot-1"
git config --global user.email "[email protected]"
git add packages/subgraph/CHANGELOG.md
git commit -am "Update changelog in subgraph"
git push
- uses: planetscale/[email protected]
with:
commit_message: 'Update changelog in subgraph'
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
file_pattern: 'packages/subgraph/CHANGELOG.md'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

# The build-deploy job builds and deploys the subgraph.
# It depends on the prepare and changelog jobs to complete successfully,
Expand Down

0 comments on commit 4f9efb4

Please sign in to comment.