<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>tutorial &amp;mdash; devops</title>
    <link>https://write.rpod.club/devops/tag:tutorial</link>
    <description></description>
    <pubDate>Tue, 20 Oct 2026 06:21:24 +0000</pubDate>
    <item>
      <title>Простая заготовка для github action</title>
      <link>https://write.rpod.club/devops/prostaia-zagotovka-dlia-github-action</link>
      <description>&lt;![CDATA[#github #action #tutorial&#xA;&#xA;Создаем файлик в репо&#xA;vim .github/workflows/demo.yml&#xA;И пишем&#xA;name: GitHub Actions&#xA;run-name: ${{ github.actor }} is testing out GitHub Actions&#xA;on: [push]&#xA;jobs:&#xA;  one:&#xA;    runs-on: ubuntu-latest&#xA;    steps:&#xA;      name: Dump GitHub context&#xA;        env:&#xA;          GITHUBCONTEXT: ${{ toJSON(github) }}&#xA;        run: echo &#34;$GITHUBCONTEXT&#34;&#xA;  changedfiles:&#xA;    runs-on: ubuntu-latest&#xA;    # Map a step output to a job output&#xA;    outputs:&#xA;      ts: ${{ steps.changes.outputs.ts }}&#xA;    steps:&#xA;        # Make sure we have some code to diff.&#xA;      name: Checkout repository&#xA;        uses: actions/checkout@v2&#xA;        with:&#xA;            fetch-depth: 0&#xA;      name: Get changed files&#xA;        id: changes&#xA;        # Set outputs using the command.&#xA;        run: |&#xA;          echo &#34;::set-output name=ts::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${{ github.sha }} | grep .swift$ | xargs)&#34;&#xA;  lint:&#xA;    runs-on: ubuntu-latest&#xA;    # require the first job to have ran&#xA;    needs: changedfiles&#xA;    # only run there are changed files&#xA;    if: ${{needs.changedfiles.outputs.ts}}&#xA;    steps:&#xA;      name: echo changed files&#xA;        run: echo ${{needs.changedfiles.outputs.ts}}&#xA;&#xA;Тут job &#34;one&#34; - просто распечатывает весь json data event, который приходит из Gighub&#xA;&#xA;А вот &#34;lint&#34; запустится только тогда, когда в будет изменен любой файл с расширением .swift (grep .swift$)&#xA;&#xA;---&#xA;&#xA;PS: Нужно помнить что &#xA;PS1: `github.event.before работает только для push, для pullrequest нужно использовать github.event.pull_request.base.sha`]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="/devops/tag:github" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">github</span></a> <a href="/devops/tag:action" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">action</span></a> <a href="/devops/tag:tutorial" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">tutorial</span></a></p>

<p>Создаем файлик в репо</p>

<pre><code>vim .github/workflows/demo.yml
</code></pre>

<p>И пишем</p>

<pre><code>name: GitHub Actions
run-name: ${{ github.actor }} is testing out GitHub Actions
on: [push]
jobs:
  one:
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJSON(github) }}
        run: echo &#34;$GITHUB_CONTEXT&#34;
  changedfiles:
    runs-on: ubuntu-latest
    # Map a step output to a job output
    outputs:
      ts: ${{ steps.changes.outputs.ts }}
    steps:
        # Make sure we have some code to diff.
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
            fetch-depth: 0
      - name: Get changed files
        id: changes
        # Set outputs using the command.
        run: |
          echo &#34;::set-output name=ts::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${{ github.sha }} | grep .swift$ | xargs)&#34;
  lint:
    runs-on: ubuntu-latest
    # require the first job to have ran
    needs: changedfiles
    # only run there are changed files
    if: ${{needs.changedfiles.outputs.ts}}
    steps:
      - name: echo changed files
        run: echo ${{needs.changedfiles.outputs.ts}}
</code></pre>

<p>Тут job “one” – просто распечатывает весь json data event, который приходит из Gighub</p>

<p>А вот “lint” запустится только тогда, когда в будет изменен любой файл с расширением .swift (grep .swift$)</p>

<hr>

<p>PS: <em>Нужно помнить что <code>::set-output name=ts::</code> скоро будет отключен</em></p>

<p>PS1: <code>github.event.before работает только для push, для pull_request нужно использовать github.event.pull_request.base.sha</code></p>
]]></content:encoded>
      <guid>https://write.rpod.club/devops/prostaia-zagotovka-dlia-github-action</guid>
      <pubDate>Tue, 25 Oct 2022 11:45:57 +0000</pubDate>
    </item>
  </channel>
</rss>