Require version in main branch with -pre suffix #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update project card status based on comment | |
on: | |
issue_comment: | |
types: [created, edited] | |
labels: | |
- 'type/epic' | |
env: | |
ORGANIZATION: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
PARENT_PROJECT: 313 | |
jobs: | |
update-status: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get comment body | |
id: get-comment | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.ISSUE_COMMANDS_TOKEN }} | |
script: | | |
const comment = await github.rest.issues.getComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: context.payload.comment.id | |
}); | |
return { body: comment.data.body }; | |
- name: Update project card status | |
id: update-status | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.ISSUE_COMMANDS_TOKEN }} | |
script: | | |
const { projectId, columnId, cardId } = context.payload.project_card; | |
const card = await github.rest.projects.getColumnCard({ | |
column_id: columnId | |
}); | |
const statusField = card.data.project_card.Trending; | |
const newStatus = /status: (\w+)/i.exec(steps.get-comment.outputs.body)[1]; | |
console.log("Status: " + newStatus) | |
if (statusField !== newStatus) { | |
await github.rest.projects.updateCard({ | |
card_id: cardId, | |
Trending: `${newStatus}` | |
}); | |
return { updated: true }; | |
} else { | |
return { updated: false }; | |
} | |
- name: Output update status | |
run: | | |
if (${{ steps.update-status.outputs.updated }}) { | |
echo "Status updated!"; | |
} else { | |
echo "No change in status."; | |
} |