Skip to content

Update README.md

Update README.md #35

Workflow file for this run

name: On Merge Group
on:
merge_group:
pull_request:
branches:
- main
jobs:
debug:
if: ${{ github.event_name == 'merge_group' }}
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Tests
run: echo "Would run tests here"
- name: Create or replace tag based on commit message
uses: actions/github-script@v6
with:
script: |
const msg = process.env.MSG;
const pattern = /CHI-[0-9]+/;
const match = msg.match(pattern);
if (!match) {
console.log("No matching pattern found in the commit message. Skipping this step.");
return;
}
const tagName = `qa/${match[0]}`;
// Check if tag exists
try {
await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tagName}`
});
// If the tag exists, delete it
console.log(`Tag ${tagName} already exists. Deleting it.`);
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tagName}`
});
} catch (error) {
if (error.status !== 404) {
throw error;
}
}
// Create the new tag
console.log(`Creating new tag: ${tagName}`);
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${tagName}`,
sha: context.sha
});
env:
MSG: ${{ github.event.merge_group.head_commit.message }}