View the standard output of the container/pod #132
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: Automated tag | |
on: | |
issue_comment: | |
types: | |
- created | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: read | |
jobs: | |
create-tag: | |
name: tag | |
runs-on: ubuntu-24.04 | |
environment: automated | |
if: > | |
(startsWith(github.event.issue.title, 'Automated npm version') && | |
github.event.issue.state == 'closed' && | |
github.event.comment.body == '/tag') || | |
(startsWith(github.event.pull_request.title, 'Automated npm version') && | |
github.event.pull_request.merged) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Get version from package.json | |
id: package-json | |
run: | | |
echo "version=$(jq -r .version freelens/package.json)" >> $GITHUB_OUTPUT | |
- name: Create tag from the main branch | |
if: steps.package-json.outputs.version | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const mainRef = await github.rest.git.getRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'heads/main', | |
}); | |
const result = await github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/v${{ steps.package-json.outputs.version }}', | |
sha: mainRef.data.object.sha, | |
}); | |
console.log(result); | |
github-token: ${{ secrets.GH_TOKEN }} |