WIP: implement clearer tagging system #9
Workflow file for this run
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: Deploy To Prodcution | |
# on: | |
# release: | |
# types: [released] | |
name: test-wf | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
GHCR_REGISTRY: ghcr.io | |
GHCR_UI_IMAGE_NAME: ${{ github.repository }}/ui | |
QUAY_REGISTRY: quay.io | |
QUAY_UI_IMAGE_NAME: instructlab-ui/ui | |
GHCR_PATHSERVICE_IMAGE_NAME: ${{ github.repository }}/pathservice | |
QUAY_PATHSERVICE_IMAGE_NAME: instructlab-ui/pathservice | |
jobs: | |
check_most_recent_pr_number: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Pull Request Number from Commit | |
id: get_pr_number | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
console.log("Repository owner:", context.repo.owner); | |
console.log("Repository name:", context.repo.repo); | |
console.log("Current commit SHA:", context.sha); | |
const prs = await github.rest.pulls.list({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'closed', | |
sort: 'updated', | |
direction: 'desc' | |
}); | |
console.log("Number of closed PRs fetched:", prs.data.length); | |
for (const pr of prs.data) { | |
console.log("Checking PR #", pr.number, "- Merged:", pr.merged); | |
if (pr.merged) { | |
console.log("Found merged PR:", pr.number); | |
return pr.number; | |
} | |
} | |
console.log("No merged PR found in the recent closed PRs."); | |
return ''; | |
- name: Build and Tag Docker Image | |
if: steps.get_pr_number.outputs.result != '' | |
env: | |
PR_NUMBER: ${{ steps.get_pr_number.outputs.result }} | |
run: | | |
echo my-image:pr-${PR_NUMBER} | |