marcosgvieira is testing out GitHub Actions π #105
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: GitHub Actions Demo | |
run-name: ${{ github.actor }} is testing out GitHub Actions π | |
on: [push] | |
jobs: | |
check-commits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Retrieve commits for release | |
id: commits | |
run: | | |
previous_tag=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)) | |
echo "::set-output name=commits::$(git log --pretty=format:'%h' --abbrev-commit ${previous_tag}..${{ github.event.release.tag_name }})" | |
- name: Generate token for Camunda GitHub org | |
id: generate-camunda-github-token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
repository: marcosgvieira/agile | |
- name: Get correlated issues | |
id: issues | |
uses: octokit/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ steps.generate-camunda-github-token.outputs.token }} | |
route: GET /repos/${{ github.repository }}/issues | |
headers: | | |
authorization: token ${{ steps.generate-camunda-github-token.outputs.token }} | |
query: | | |
q=sha:(${{ steps.commits.outputs.commits }}) | |
- name: Search for SEC-123 | |
id: search | |
run: | | |
pattern="SEC-123" | |
matches=$(echo "${{ steps.issues.outputs.data }}" | jq -r '.[] | select(.body | contains($pattern)) | .html_url') | |
if [[ -n "$matches" ]]; then | |
echo "::set-output name=found::true" | |
else | |
echo "::set-output name=found::false" | |
fi | |