-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor GHAs #124
Refactor GHAs #124
Changes from 4 commits
68b466e
944378e
cc12cff
47e4d70
da868e6
cf69de6
1d10865
01209f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,9 @@ runs: | |
yarn tsc | ||
yarn oclif readme \ | ||
--no-aliases \ | ||
--version ${{ steps.next-version.outputs.tag }} \ | ||
--version "$STEPS_NEXT_VERSION_TAG" \ | ||
${{ inputs.multi == 'true' && '--multi' || '' }} \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expressions that render values that don't include the |
||
--repository-prefix "<%- repo %>/blob/<%- version %>/<%- commandPath %>" \ | ||
|| echo "::warning::'oclif readme' failed. Check the logs." | ||
env: | ||
STEPS_NEXT_VERSION_TAG: ${{ steps.next-version.outputs.tag }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,51 @@ | ||
name: get-json-property | ||
description: Get a property from a json file using jq | ||
description: Get a property from a json file with dot notation | ||
|
||
# Examples: | ||
# prop_path: version | ||
# prop_path: devDependencies["@salesforce/dev-scripts"] | ||
# ^ Note: double quotes needed here | ||
# prop_path: devDependencies.@salesforce/dev-scripts | ||
|
||
inputs: | ||
path: | ||
required: true | ||
description: Json file to look up prop (package.json) | ||
prop_path: | ||
required: true | ||
description: jq query to search (version) | ||
description: dot notation property to find (version) | ||
|
||
outputs: | ||
prop: | ||
description: The value of the prop_path | ||
value: ${{ steps.jq.outputs.prop }} | ||
value: ${{ steps.parse.outputs.prop }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get property from json file | ||
id: jq | ||
shell: bash | ||
run: | | ||
PROP=$(jq -r '.${{ inputs.prop_path }}' ${{ inputs.path }}) | ||
echo "prop=$PROP" >> "$GITHUB_OUTPUT" | ||
- name: Exit if prop was not found | ||
if: ${{ steps.jq.outputs.prop == 'null' }} | ||
id: parse | ||
uses: actions/github-script@v7 | ||
with: | ||
script: core.setFailed("Property '${{ inputs.prop_path }}' not found in ${{ inputs.path }}") | ||
result-encoding: string | ||
script: | | ||
try { | ||
const fs = require('fs') | ||
|
||
var path = process.env.INPUTS_PATH; | ||
var propPath = process.env.INPUTS_PROP_PATH; | ||
|
||
const json = JSON.parse(fs.readFileSync(path)) | ||
|
||
// https://stackoverflow.com/a/43849204 | ||
const result = propPath.split('.').reduce((p,c)=>p&&p[c]||null, json) | ||
|
||
if (result) { | ||
core.setOutput('prop', result) | ||
} else { | ||
core.setFailed(`Property '${propPath}' not found in '${path}'`) | ||
} | ||
} catch(err) { | ||
core.setFailed(err) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
env: | ||
INPUTS_PATH: ${{ inputs.path }} | ||
INPUTS_PROP_PATH: ${{ inputs.prop_path }} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,17 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
|
||
- run: npm install -g @salesforce/plugin-release-management --omit=dev | ||
|
||
- name: run automerge command | ||
if: ${{ !inputs.skipCI }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN}} | ||
run: sf-release dependabot:automerge --merge-method ${{ inputs.mergeMethod}} --max-version-bump ${{ inputs.maxVersionBump}} --owner $GITHUB_REPOSITORY_OWNER --repo $(basename $GITHUB_REPOSITORY) | ||
- name: run automerge command | ||
if: ${{ inputs.skipCI }} | ||
run: sf-release dependabot:automerge --merge-method "$INPUTS_MERGE_METHOD" --max-version-bump "$INPUTS_MAX_VERSION_BUMP" --owner $GITHUB_REPOSITORY_OWNER --repo $(basename $GITHUB_REPOSITORY) ${{ inputs.skipCI && '--skip-ci' || '' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This diff is confusing. I turned two steps into one using a "ternaryish" |
||
env: | ||
GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN}} | ||
run: sf-release dependabot:automerge --merge-method ${{ inputs.mergeMethod}} --max-version-bump ${{ inputs.maxVersionBump}} --owner $GITHUB_REPOSITORY_OWNER --repo $(basename $GITHUB_REPOSITORY) --skip-ci | ||
GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
INPUTS_MERGE_METHOD: ${{ inputs.mergeMethod }} | ||
INPUTS_MAX_VERSION_BUMP: ${{ inputs.maxVersionBump }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: You need to escape the space after a
:
if you want it to be valid yaml. Or put it on a new line...