Leverage branch prefix repo vars in .github/workflows/release-branch-pull-request-handler.yml

This commit is contained in:
Max Goldfarb 2022-11-18 20:10:52 +00:00
Родитель 8f06ae3ee6
Коммит 493f2d9bc8
2 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -29,11 +29,10 @@ jobs:
run: npm ci
- name: Parse Issue Number
id: branchFilter
with:
branchName: ${{ github.head_ref }}
issuePrefix: "issue-"
run: |
node ./node-scripts/branch-filter.js
env:
BRANCH_NAME: ${{ github.head_ref }}
ISSUE_PREFIX: ${{ vars.ISSUE_BRANCH_PREFIX }}
run: node ./node-scripts/branch-filter.js
- name: Install sfdx Plugins
if: steps.branchFilter.outputs.matches == 'true'
run: |
@ -51,7 +50,7 @@ jobs:
if: vars.GENERATE_RELEASE == 'true' && steps.branchFilter.outputs.matches == 'true'
id: check_first_deploy
run: |
if [ -f release-notes/issue-${{ steps.branchFilter.outputs.issueNumber }}.md ]; then echo "::set-output name=FIRST_DEPLOY::false"; else echo "::set-output name=FIRST_DEPLOY::true"; fi
if [ -f release-notes/${{ vars.ISSUE_BRANCH_PREFIX }}${{ steps.branchFilter.outputs.issueNumber }}.md ]; then echo "::set-output name=FIRST_DEPLOY::false"; else echo "::set-output name=FIRST_DEPLOY::true"; fi
- name: Generate Destructive Changes Param
if: steps.branchFilter.outputs.matches == 'true' && steps.check_first_deploy.outputs.FIRST_DEPLOY == 'true'
id: check_for_destructive_changes
@ -97,8 +96,8 @@ jobs:
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -s ${ISSUE_URL} > issue.json
ISSUE_HTML_URL=$(jq -r '.html_url' issue.json)
ISSUE_TITLE=$(jq -r '.title' issue.json)
touch release-notes/issue-${{ steps.branchFilter.outputs.issueNumber }}.md
echo -e "1. [#${{ steps.branchFilter.outputs.issueNumber }} - ${ISSUE_TITLE}](${ISSUE_HTML_URL})\n" > release-notes/issue-${{ steps.branchFilter.outputs.issueNumber }}.md
touch release-notes/${{ vars.ISSUE_BRANCH_PREFIX }}${{ steps.branchFilter.outputs.issueNumber }}.md
echo -e "1. [#${{ steps.branchFilter.outputs.issueNumber }} - ${ISSUE_TITLE}](${ISSUE_HTML_URL})\n" > release-notes/${{ vars.ISSUE_BRANCH_PREFIX }}${{ steps.branchFilter.outputs.issueNumber }}.md
ISSUE_JSON="$(cat issue.json)"
ISSUE_JSON="${ISSUE_JSON//'%'/'%25'}"
ISSUE_JSON="${ISSUE_JSON//$'\n'/'%0A'}"
@ -110,4 +109,4 @@ jobs:
with:
branch: ${{ github.head_ref }}
commit_message: Add issue release notes
file_pattern: release-notes/issue-${{ steps.branchFilter.outputs.issueNumber }}.md
file_pattern: release-notes/${{ vars.ISSUE_BRANCH_PREFIX }}${{ steps.branchFilter.outputs.issueNumber }}.md

Просмотреть файл

@ -3,9 +3,8 @@ const github = require("@actions/github");
(function start() {
try {
const issuePrefix = process.env.ISSUE_PREFIX;
console.log(`issuePrefix: ${issuePrefix}`);
let ref = core.getInput("branchName");
const issuePrefix = process.env?.ISSUE_PREFIX;
let ref = process.env?.BRANCH_NAME;
if (!ref) {
ref = github.context.ref;
}