Update workflows. Keep only necessary ones

This commit is contained in:
Dany Sam 2025-04-11 14:01:08 +05:30
parent f77a1cd7fa
commit 3c8f50ae72
8 changed files with 201 additions and 89 deletions

2
.github/CODEOWNERS vendored
View file

@ -1 +1 @@
* @actions/actions-cache
* @danySam

View file

@ -12,11 +12,11 @@ jobs:
steps:
- uses: actions/stale@v9
with:
days-before-issue-stale: 200
days-before-issue-close: 5
days-before-issue-stale: 90
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days."
close-issue-message: "This issue was closed because it has been inactive for 5 days since being marked as stale."
stale-issue-message: "This issue is stale because it has been open for 90 days with no activity. Leave a comment to avoid closing this issue in 14 days."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -0,0 +1,127 @@
name: GCS Integration Tests
on:
push:
branches: [main]
paths-ignore:
- '**.md'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
test-gcs-basic:
runs-on: ubuntu-latest
env:
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up GCP credentials
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Generate test files
run: |
mkdir -p gcs-test-cache
echo "Test content $(date)" > gcs-test-cache/test1.txt
echo "More test content $(date)" > gcs-test-cache/test2.txt
- name: Save cache to GCS
id: cache-save
uses: ./
with:
path: gcs-test-cache
key: gcs-integration-${{ github.run_id }}
gcs-bucket: ${{ env.GCS_BUCKET }}
- name: Delete local cache
run: rm -rf gcs-test-cache
- name: Restore cache from GCS
id: cache-restore
uses: ./
with:
path: gcs-test-cache
key: gcs-integration-${{ github.run_id }}
gcs-bucket: ${{ env.GCS_BUCKET }}
- name: Verify cache contents
run: |
if [ ! -f "gcs-test-cache/test1.txt" ] || [ ! -f "gcs-test-cache/test2.txt" ]; then
echo "Cache files not restored correctly"
exit 1
fi
echo "Cache successfully restored from GCS"
test-gcs-cross-runner:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up GCP credentials
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Generate cross-platform files
shell: bash
run: |
mkdir -p cross-platform-cache
echo "Cross-platform test content ${{ runner.os }} $(date)" > cross-platform-cache/test-${{ runner.os }}.txt
- name: Save to GCS with cross-platform key
uses: ./
with:
path: cross-platform-cache
key: cross-platform-${{ github.run_id }}
gcs-bucket: ${{ env.GCS_BUCKET }}
gcs-path-prefix: cross-platform-tests
test-gcs-fallback:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate fallback test files
run: |
mkdir -p fallback-cache
echo "Fallback test content $(date)" > fallback-cache/fallback.txt
- name: Test fallback to GitHub cache
uses: ./
with:
path: fallback-cache
key: fallback-test-${{ github.run_id }}
gcs-bucket: "this-bucket-does-not-exist-${{ github.run_id }}"
- name: Delete local cache
run: rm -rf fallback-cache
- name: Restore with fallback
id: restore-fallback
uses: ./
with:
path: fallback-cache
key: fallback-test-${{ github.run_id }}
gcs-bucket: "this-bucket-does-not-exist-${{ github.run_id }}"
- name: Verify fallback mechanism worked
run: |
if [ ! -f "fallback-cache/fallback.txt" ]; then
echo "Fallback mechanism did not work correctly"
exit 1
fi
echo "Successfully fell back to GitHub cache"

View file

@ -1,16 +0,0 @@
name: Assign issue
on:
issues:
types: [opened]
jobs:
run-action:
runs-on: ubuntu-latest
steps:
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: add_assignees
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'

View file

@ -1,20 +0,0 @@
name: Add Reviewer PR
on:
pull_request_target:
types: [opened]
jobs:
run-action:
runs-on: ubuntu-latest
steps:
- name: Get current oncall
id: oncall
run: |
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
- name: Request Review
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}'
- name: Add Assignee
run: |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'

View file

@ -1,20 +0,0 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [released]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@0.0.3

View file

@ -1,28 +0,0 @@
name: Release new action version
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View file

@ -127,3 +127,72 @@ jobs:
path: test-cache
- name: Verify cache
run: __tests__/verify-cache-files.sh proxy test-cache
# GCS integration tests
test-gcs-save:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
env:
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up GCP credentials
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Generate files
run: __tests__/create-cache-files.sh gcs test-gcs-cache
- name: Save cache to GCS
uses: ./
with:
key: test-gcs-${{ github.run_id }}
path: test-gcs-cache
gcs-bucket: ${{ env.GCS_BUCKET }}
test-gcs-restore:
needs: test-gcs-save
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
env:
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up GCP credentials
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Restore cache from GCS
uses: ./
with:
key: test-gcs-${{ github.run_id }}
path: test-gcs-cache
gcs-bucket: ${{ env.GCS_BUCKET }}
- name: Verify GCS cache
run: __tests__/verify-cache-files.sh gcs test-gcs-cache
test-gcs-fallback:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
env:
GCS_BUCKET: "non-existent-bucket-for-test"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate files
run: __tests__/create-cache-files.sh fallback test-fallback-cache
- name: Save with GCS fallback
uses: ./
with:
key: test-fallback-${{ github.run_id }}
path: test-fallback-cache
gcs-bucket: ${{ env.GCS_BUCKET }}
- name: Restore with GCS fallback
uses: ./
with:
key: test-fallback-${{ github.run_id }}
path: test-fallback-cache
gcs-bucket: ${{ env.GCS_BUCKET }}
- name: Verify Fallback cache
run: __tests__/verify-cache-files.sh fallback test-fallback-cache